This commit is contained in:
陆柯 2021-12-10 20:16:52 +08:00
parent fd5f401430
commit 900293da36
4 changed files with 27 additions and 30 deletions

View File

@ -1,12 +0,0 @@
#!/bin/bash
read -p "Enable autologin as user? >>> " UserName
if [ $UserName ]
then
sed -i "s/^.*autologin-user=.*$/autologin-user=$UserName/g" /etc/lightdm/lightdm.conf
sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "Successfully configured autologin as $UserName"
else
echo 'Nothing changed.'
fi

View File

@ -60,7 +60,7 @@ echo
# Debian 10 default to /bin/sh
sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd
# Debian 9 default to empty
sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash/g" /etc/passwd
sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd
echo "<<< Allow the new user $NewUser to sudo without password"
#### Option 1: Add the new user to %sudo group in /etc/sudoers file
@ -83,9 +83,16 @@ sed -i "s|^PermitRootLogin yes|#PermitRootLogin yes|g" /etc/ssh/sshd_config
service sshd restart
echo
#echo "<<< autologin for Xfce: /etc/lightdm/lightdm.conf"
#sed -i "s/^#autologin-user=$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
#sed -i "s/^#autologin-user-timeout=0$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "<<< autologin for Xfce: /etc/lightdm/lightdm.conf"
read -p "<<< Enable xfce autologin as ($NewUser for autologin or anything else for no change): " XfceAutologinUsername
if [ $XfceAutologinUsername = $NewUser ]
then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "Successfully configured autologin as $NewUser"
else
echo 'Nothing changed >>>'
fi
echo "<<< Configure autostart"
if [ -f /etc/rc.local ]

View File

@ -1,6 +1,6 @@
#!/bin/bash
echo "Usage: setup.sh [nodeVersion]"
echo "Usage: this-script.sh [nodeVersion]"
defaultVersion=16
@ -8,7 +8,7 @@ if [ v$1 != v ]
then
nodeVersion=$1
else
read -p "Enter nodejs version (leave blank for default 16; 'nvm' for nvm) >> " nodeVersion
read -p "Enter nodejs version (leave blank for default $defaultVersion) >> " nodeVersion
if [ ! $nodeVersion ]
then
nodeVersion=$defaultVersion
@ -16,16 +16,11 @@ else
fi
fi
if [ $nodeVersion == 'nvm' ]
then
echo "######## Installing nvm ############################"
else
sudo apt update
echo "######## Installing C++ build tools for Linux ########"
sudo apt install curl gcc g++ make python -y # Debian 11 has no python by default.
sudo apt update
echo "######## Installing C++ build tools for Linux ########"
sudo apt install curl gcc g++ make python -y # Debian 11 has no python by default.
echo "######## Installing nodejs v$nodeVersion ########"
echo From https://deb.nodesource.com/setup_$nodeVersion.x
curl -sL https://deb.nodesource.com/setup_$nodeVersion.x | sudo bash - && sudo apt install nodejs -y
echo "######## nodejs v$nodeVersion installed completely! ########"
fi
echo "######## Installing nodejs v$nodeVersion ########"
echo From https://deb.nodesource.com/setup_$nodeVersion.x
curl -sL https://deb.nodesource.com/setup_$nodeVersion.x | sudo bash - && sudo apt install nodejs -y
echo "######## nodejs v$nodeVersion installed completely! ########"

7
install-nvm.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "Usage: this-script.sh"
defaultVersion=0.39.0
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$defaultVersion/install.sh | bash