mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-24 14:11:55 +00:00
even more + ,,
This commit is contained in:
parent
9618128ff8
commit
f688f0c9dd
|
@ -242,7 +242,7 @@ userinfo () {
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read -r -p "Please enter username: " username
|
read -r -p "Please enter username: " username
|
||||||
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
|
if echo "$username" | grep -qE '^[a-z_][a-z0-9_-]{0,31}(\$)?$'
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -267,20 +267,23 @@ userinfo () {
|
||||||
# Loop through user input until the user gives a valid hostname, but allow the user to force save
|
# Loop through user input until the user gives a valid hostname, but allow the user to force save
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read -r -p "Please name your machine: " name_of_machine
|
printf "%b" "Please name your machine: "
|
||||||
# hostname regex (!!couldn't find spec for computer name!!)
|
read -r machine_name
|
||||||
if [[ "${name_of_machine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
|
|
||||||
|
lower_machine_name=$(echo "$machine_name" | tr '[:upper:]' '[:lower:]')
|
||||||
|
if echo "$lower_machine_name" | grep -q '^[a-z][a-z0-9_.-]\{0,62\}[a-z0-9]$'
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
# if validation fails allow the user to force saving of the hostname
|
# if validation fails allow the user to force saving of the hostname
|
||||||
read -r -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
|
printf "%b" "Hostname doesn't seem correct. Do you still want to save it? (y/N) "
|
||||||
if [[ "${force,,}" = "y" ]]
|
read -r force
|
||||||
|
if [[ "$force" == "y" || "$force" == "Y" ]]
|
||||||
then
|
then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
export NAME_OF_MACHINE=$name_of_machine
|
export NAME_OF_MACHINE=$lower_machine_name
|
||||||
}
|
}
|
||||||
|
|
||||||
# Starting functions
|
# Starting functions
|
||||||
|
@ -376,7 +379,7 @@ subvolumesetup () {
|
||||||
mountallsubvol
|
mountallsubvol
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${DISK}" =~ "nvme" ]]; then
|
if echo "$DISK" | grep -q "nvme"; then
|
||||||
partition2=${DISK}p2
|
partition2=${DISK}p2
|
||||||
partition3=${DISK}p3
|
partition3=${DISK}p3
|
||||||
else
|
else
|
||||||
|
@ -670,4 +673,4 @@ sed -i 's/^%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# %wheel ALL=(ALL:ALL) NOPASSWD: A
|
||||||
# Add sudo rights
|
# Add sudo rights
|
||||||
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
|
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
|
||||||
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
|
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in New Issue
Block a user