Update setup.sh
This commit is contained in:
parent
e2a2100dbf
commit
3a849d1d6c
1 changed files with 33 additions and 10 deletions
29
setup.sh
29
setup.sh
|
@ -1,7 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
pacman -S git
|
|
||||||
git clone https://github.com/fhdk/lxqt-kwin
|
# https://stackoverflow.com/questions/38427000/bash-validating-user-name-with-regex
|
||||||
cd lxqt-kwin
|
isValidUsername() {
|
||||||
|
local re='^[[:lower:]_][[:lower:][:digit:]_-]{2,15}$'
|
||||||
|
(( ${#1} > 16 )) && return 1
|
||||||
|
[[ $1 =~ $re ]] # return value of this comparison is used for the function
|
||||||
|
}
|
||||||
|
|
||||||
|
SCRIPTNAME=$(basename "$0")
|
||||||
|
VERSION="0.1"
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Required username is mussing."
|
||||||
|
echo "Add a lowercase username using ascii alpha digits only (no number digits) as first argument."
|
||||||
|
echo " e.g. ${SCRIPTNAME} fido"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if isValidUsername "$1"; then
|
||||||
pacman -Syu --needed - < $PWD/Packages-Desktop
|
pacman -Syu --needed - < $PWD/Packages-Desktop
|
||||||
systemctl enable NetworkManager
|
systemctl enable NetworkManager
|
||||||
systemctl enable sddm
|
systemctl enable sddm
|
||||||
|
@ -9,3 +25,10 @@ systemctl enable firewalld
|
||||||
cp -r $PWD/etc/. /etc/
|
cp -r $PWD/etc/. /etc/
|
||||||
cp -r $PWD/usr/. /usr/
|
cp -r $PWD/usr/. /usr/
|
||||||
cp -r $PWD/root/. /root/
|
cp -r $PWD/root/. /root/
|
||||||
|
useradd -mUG lp,wheel,network,video $1
|
||||||
|
passwd $1
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "$1 is not a valid username"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue