This commit is contained in:
陆柯 2022-06-18 11:14:43 +08:00
parent 0ddecd40c3
commit 2782c12fb1
2 changed files with 10 additions and 3 deletions

View File

@ -36,7 +36,7 @@ echo
# 注意,在这里为新用户创建的配置文件,主人是 root而不是新用户
if [ $NewUser = 'adot' ]
then
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser --AdotMode
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser
else
echo "<<< Configure $NewUser home with standard scripts? (注意,由 root 为新用户创建的配置文件的 owner 是 root而不是新用户)"
read -p "y for yes, anything else for no >> " YesOrNo

View File

@ -35,11 +35,12 @@ if [ -d $SourcePath ] && [ -d $HomePath ]
then
pushd $HomePath
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
read -p "Copy or link scripts? l for link, anything else for copy >> " CopyOrLinkScripts
for homescript in $homescriptlist
do
rm -fr $homescript.backup
mv $homescript $homescript.backup
if [ $3 = '--AdotMode' ] # $3 通常不输入,所以默认是拷贝模式
if [ $CopyOrLinkScripts = 'l' ]
then
echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..."
ln -s $SourcePath/$homescript $HomePath
@ -48,7 +49,8 @@ then
cp -r $SourcePath/$homescript $HomePath
fi
done
if [ $3 = '--AdotMode' ] # $3 通常不输入,所以默认是不给其他用户链接到 authorized_keys
read -p "Append or link or omit [.ssh/authorized_keys]? a for append, l for link, anything else for omit >> " CopyOrLinkOrOmitAuthorizedKeys
if [ $CopyOrLinkOrOmitAuthorizedKeys = 'l' ]
then
echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..."
mkdir -p $HomePath/.ssh
@ -59,6 +61,11 @@ then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup
fi
ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys
elif [ $CopyOrLinkOrOmitAuthorizedKeys = 'a']
mkdir -p $HomePath/.ssh
chmod 700 $HomePath/.ssh
cat $SourcePath/.ssh/authorized_keys >> $HomePath/.ssh/authorized_keys
chmod 600 $HomePath/.ssh/authorized_keys
fi
popd
else