-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigurationRoot.sh
81 lines (66 loc) · 1.61 KB
/
ConfigurationRoot.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
R_R_FILES_PATH="/root/Files"
U_R_FILES_PATH=""
PROFILE=$(cat "$R_R_FILES_PATH/Information/Profile.txt")
function main() {
initialize
clearFiles
installPlatformPackages
addUsers
rebootComputer
}
function initialize() {
shopt -s dotglob
}
function clearFiles() {
echo "root ALL=(ALL:ALL) ALL" > /etc/sudoers
}
function installPlatformPackages() {
if [[ $PROFILE = "GrayLaptop" ]]
then
pacman -S sof-firmware
fi
}
function addUsers() {
addUser
addedUsers=false
while ! $addedUsers
do
echo "Add more users?"
select choice in "No" "Yes"
do
case $choice in
"No")
addedUsers=true
break
;;
"Yes")
addUser
break
;;
esac
done
done
}
function addUser() {
echo "Enter user name: "
read -r userName
useradd -m "$userName"
echo "Enter password for user $userName."
while ! passwd "$userName"
do
echo "Enter password for user $userName."
done
U_R_FILES_PATH="/home/$userName/Files"
cp -r "$R_R_FILES_PATH/" "$U_R_FILES_PATH/"
find "$U_R_FILES_PATH" -type d -exec chmod 755 {} \;
find "$U_R_FILES_PATH" -type f -exec chmod 644 {} \;
find "$U_R_FILES_PATH" -type f -name "*.sh" -exec chmod 744 {} \;
chown -R "$userName:$userName" "$U_R_FILES_PATH/"
echo "$userName ALL=(ALL:ALL) ALL" | EDITOR="tee -a" visudo
usermod -aG video $userName
}
function rebootComputer() {
reboot
}
main