Save WiFi connections using the live user

* Instead of the build user
This commit is contained in:
2Shirt 2019-05-23 18:05:30 -06:00
parent bd77216ab7
commit cb0275dc9d
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 11 additions and 2 deletions

View file

@ -4,6 +4,7 @@
import os
import re
import sys
import uuid
KNOWN_NETWORKS = '/root/known_networks'
@ -34,13 +35,21 @@ method=auto
'''
def get_user_name():
"""Get real user name, returns str."""
"""Get user name, returns str."""
user = None
# Get running user
if 'SUDO_USER' in os.environ:
user = os.environ.get('SUDO_USER')
else:
user = os.environ.get('USER')
# Check if user manually specified
for a in sys.argv:
a = a.strip().lower()
if a.startswith('--user='):
user - a.replace('--user=', '')
return user
if __name__ == '__main__':

View file

@ -284,7 +284,7 @@ function update_live_env() {
# WiFi
cp "$ROOT_DIR/.linux_items/known_networks" "$LIVE_DIR/airootfs/root/known_networks"
echo "add-known-networks" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo "add-known-networks --user=$username" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
}
function update_repo() {