source: calamares/trunk/fuentes/src/modules/removeuser/main.py @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 17 months ago

sync with github

File size: 1.4 KB
Line 
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# === This file is part of Calamares - <https://github.com/calamares> ===
5#
6#   Copyright 2015, Teo Mrnjavac <teo@kde.org>
7#   Copyright 2017. Alf Gaida <agaida@siduction.org>
8#
9#   Calamares is free software: you can redistribute it and/or modify
10#   it under the terms of the GNU General Public License as published by
11#   the Free Software Foundation, either version 3 of the License, or
12#   (at your option) any later version.
13#
14#   Calamares is distributed in the hope that it will be useful,
15#   but WITHOUT ANY WARRANTY; without even the implied warranty of
16#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17#   GNU General Public License for more details.
18#
19#   You should have received a copy of the GNU General Public License
20#   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
21
22import subprocess
23import libcalamares
24
25
26def run():
27    """
28    Remove live user from target system
29    """
30    username = libcalamares.job.configuration["username"]
31
32    try:
33        libcalamares.utils.check_target_env_call(["userdel", "-f",
34                                                  "-r", username])
35    except subprocess.CalledProcessError as e:
36        libcalamares.utils.debug("Cannot remove user. "
37                                 "'userdel' terminated with exit code "
38                                 "{}.".format(e.returncode))
39    return None
Note: See TracBrowser for help on using the repository browser.