-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·42 lines (41 loc) · 1.03 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
printf "Please choose the username:\n"
read username
printf "Please choose the hostname:\n"
read hostname
printf "Please choose the password:\n"
read pass
passhash=$(openssl passwd -6 $pass)
cp airootfs/etc/passwd airootfs/etc/passwd.bak
cat > airootfs/etc/passwd << EOF
root:x:0:0:root:/root:/bin/bash
$username:x:1000:1000:$username:/home/$username:/bin/bash
EOF
# Specify groups
cp airootfs/etc/group airootfs/etc/group.bak
cat > airootfs/etc/group << EOF
root:x:0:root
$username:x:1000:$username
wheel:x:998:$username
EOF
# SEt password for username and root to username
cp airootfs/etc/shadow airootfs/etc/shadow.bak
cat > airootfs/etc/shadow << EOF
root:$passhash:14871::::::
$username:$passhash:19146:0:99999:7:::
EOF
# Set hostname
cp airootfs/etc/hostname airootfs/etc/hostname.bak
cat > airootfs/etc/hostname << EOF
$hostname
EOF
echo "HOME=/home/$username" > airootfs/etc/env
printf "Done, delete backupfiles? (y/n)\n"
read del
if [ $del = y ]
then
rm airootfs/etc/*.bak
else
exit 0
fi
cat ./packages/*.pkgs > packages.x86_64