Debug scripts

This commit is contained in:
Anthony Wang 2021-08-03 09:08:35 -05:00
parent 366512c0f6
commit e35e08b058
Signed by: a
GPG key ID: BC96B00AEC5F2D76
2 changed files with 11 additions and 2 deletions

View file

@ -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)

View file

@ -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')