Ubuntu & Debian: Use variable for username

Signed-off-by: Scott G. Ainsworth <scott@ainsworth.us>
Signed-off-by: Richard Laager <rlaager@wiktel.com>
[Applied to Ubuntu 20.04 Raspberry Pi & Debian Buster.]
This commit is contained in:
Scott G. Ainsworth
2021-10-12 21:34:59 -04:00
committed by Richard Laager
parent 4c3ec4c594
commit 3c04e929a1
3 changed files with 26 additions and 20 deletions

View File

@@ -1069,19 +1069,21 @@ Step 6: First Boot
#. Create a user account:
Replace ``username`` with your desired username::
Replace ``YOUR_USERNAME`` with your desired username::
username=YOUR_USERNAME
UUID=$(dd if=/dev/urandom bs=1 count=100 2>/dev/null |
tr -dc 'a-z0-9' | cut -c-6)
ROOT_DS=$(zfs list -o name | awk '/ROOT\/ubuntu_/{print $1;exit}')
zfs create -o com.ubuntu.zsys:bootfs-datasets=$ROOT_DS \
-o canmount=on -o mountpoint=/home/username \
rpool/USERDATA/username_$UUID
adduser username
-o canmount=on -o mountpoint=/home/$username \
rpool/USERDATA/${username}_$UUID
adduser $username
cp -a /etc/skel/. /home/username
chown -R username:username /home/username
usermod -a -G adm,cdrom,dip,lpadmin,lxd,plugdev,sambashare,sudo username
cp -a /etc/skel/. /home/$username
chown -R $username:$username /home/$username
usermod -a -G adm,cdrom,dip,lpadmin,lxd,plugdev,sambashare,sudo $username
Step 7: Full Software Installation
----------------------------------