Debug scripts
This commit is contained in:
parent
366512c0f6
commit
e35e08b058
7
adduser
7
adduser
|
@ -50,6 +50,7 @@ os.system('vim ' + filename)
|
|||
confirm = input('OK? (y/n) ')
|
||||
|
||||
if confirm != 'y':
|
||||
os.system('gio trash ' + filename)
|
||||
exit(0)
|
||||
|
||||
|
||||
|
@ -57,12 +58,14 @@ if confirm != 'y':
|
|||
os.system('ldapadd -D "cn=Manager,dc=exozy,dc=me" -W -f ' + filename)
|
||||
|
||||
# Configure user
|
||||
os.system('sudo mkhomedir_helper ' + username)
|
||||
os.system('sudo -u ' + username + ' mkdir /home/' + username + '/.config')
|
||||
os.system('sudo -u ' + username + ' flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo --user')
|
||||
os.system('sudo -u ' + username + ' xdg-settings set default-web-browser firefox.desktop')
|
||||
|
||||
# Set up rootless Podman
|
||||
# https://wiki.archlinux.org/title/Podman#Set_subuid_and_subgid
|
||||
start = str((uid - 999) * 100000)
|
||||
start = str((int(uid) - 999) * 100000)
|
||||
end = str(int(start) + 65535) # Allocate 65536 UIDs
|
||||
os.system('sudo usermod --add-subuids ' + start + '-' + end + ' --add-subgids ' + start + '-' + end)
|
||||
os.system('sudo usermod --add-subuids ' + start + '-' + end + ' --add-subgids ' + start + '-' + end + ' ' + username)
|
||||
|
||||
|
|
6
deluser
6
deluser
|
@ -10,3 +10,9 @@ username = input('Enter username: ')
|
|||
# Delete user
|
||||
os.system('ldapdelete -W -D "cn=Manager,dc=exozy,dc=me" "uid=' + username + ',ou=People,dc=exozy,dc=me" "cn=' + username + ',ou=Group,dc=exozy,dc=me"')
|
||||
|
||||
# Cleanup
|
||||
os.system('sudo rm -rf /home/' + username)
|
||||
os.system('sudo sed -i \'/' + username + '/d\' /etc/subuid')
|
||||
os.system('sudo sed -i \'/' + username + '/d\' /etc/subgid')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue