This commit is contained in:
陆柯 2021-11-04 16:22:17 +08:00
parent 8159d7439e
commit 96456b1f2b
2 changed files with 25 additions and 50 deletions

View File

@ -31,11 +31,8 @@ then
git clone https://git.faronear.org/fon/sysconfig /faronear/fon/sysconfig git clone https://git.faronear.org/fon/sysconfig /faronear/fon/sysconfig
fi fi
echo "<<< Configure home" echo "<<< Configure root home"
if [ ! -f "~/.bashrc.backup" ] source /faronear/fon/sysconfig/config-home.sh /faronear/fon/sysconfig/home
then
source /faronear/fon/sysconfig/config-home.sh /faronear/fon/sysconfig/home
fi
echo "<<< Change root password" echo "<<< Change root password"
passwd passwd
@ -46,7 +43,10 @@ passwd $NewUser
mkdir /home/$NewUser mkdir /home/$NewUser
chown $NewUser:$NewUser /home/$NewUser chown $NewUser:$NewUser /home/$NewUser
chmod 700 /home/$NewUser chmod 700 /home/$NewUser
# emacs /etc/passwd
echo "<<< Configure $NewUser home"
source /faronear/fon/sysconfig/config-home.sh /faronear/fon/sysconfig/home /home/$NewUser
# Debian 10 default to /bin/sh # Debian 10 default to /bin/sh
sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd
# Debian 9 default to empty # Debian 9 default to empty

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
echo "Usage: setup.sh [Source-Path-To-Config-Files]" echo "Usage: setup.sh [Config-Source-Path] [User-Home-Path]"
echo "---------------------------------------------" echo "---------------------------------------------"
if [ $1 ] if [ $1 ]
@ -25,56 +25,31 @@ else
fi fi
fi fi
if [ $2 ]
then
HomePath=$2
else
HomePath=~
fi
if [ ! -d $SourcePath ] if [ ! -d $SourcePath ]
then then
echo "!!! Not existing $SourcePath, please try again" echo "!!! Not existing $SourcePath, please try again"
else else
echo "Copy home scripts from $SourcePath" echo "Copy home scripts from $SourcePath"
pushd $HomePath
echo "---------------------------------------------" echo "---------------------------------------------"
if [ -e ~/.emacs ]
then
mv ~/.emacs ~/.emacs.backup
fi
rm -fr ~/.emacs
ln -s $SourcePath/.emacs ~/
echo Linked ~/.emacs to $SourcePath/.emacs
echo "---------------------------------------------" for homescript in '.emacs .emacs.lisp .bashrc .bash_profile .gitignore'
if [ -e ~/.emacs.lisp ] do
if [ -f $homescript ]
then then
mv ~/.emacs.lisp ~/.emacs.lisp.backup mv $homescript $homescript.backup
fi fi
rm -fr ~/.emacs.lisp rm -fr $homescript
ln -s $SourcePath/.emacs.lisp ~/ ln -s $SourcePath/$homescript $HomePath
echo Linked ~/.emacs.lisp to $SourcePath/.emacs.lisp echo Linked $HomePath/$homescript to $SourcePath/$homescript
done
echo "---------------------------------------------"
if [ -e ~/.bashrc ]
then
mv ~/.bashrc ~/.bashrc.backup
fi
rm -fr ~/.bashrc
ln -s $SourcePath/.bashrc ~/
echo Linked ~/.bashrc to $SourcePath/.bashrc
echo "---------------------------------------------"
if [ -e ~/.bash_profile ]
then
mv ~/.bash_profile ~/.bash_profile.backup
fi
rm -fr ~/.bash_profile
ln -s $SourcePath/.bash_profile ~/
echo Linked ~/.bash_profile to $SourcePath/.bash_profile
echo "---------------------------------------------"
if [ -e ~/.gitignore ]
then
mv ~/.gitignore ~/.gitignore.backup
fi
rm -fr ~/.gitignore
ln -s $SourcePath/.gitignore ~/
echo Linked ~/.gitignore to $SourcePath/.gitignore
echo "---------------------------------------------" echo "---------------------------------------------"
echo Executing ~/.bashrc echo Executing ~/.bashrc