u
This commit is contained in:
parent
4cbc029412
commit
0ddecd40c3
@ -34,10 +34,14 @@ chmod a-w /etc/sudoers.d/${NewUser//./-}
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
# 注意,在这里为新用户创建的配置文件,主人是 root,而不是新用户
|
# 注意,在这里为新用户创建的配置文件,主人是 root,而不是新用户
|
||||||
|
if [ $NewUser = 'adot' ]
|
||||||
|
then
|
||||||
|
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser --AdotMode
|
||||||
|
else
|
||||||
echo "<<< Configure $NewUser home with standard scripts? (注意,由 root 为新用户创建的配置文件的 owner 是 root,而不是新用户)"
|
echo "<<< Configure $NewUser home with standard scripts? (注意,由 root 为新用户创建的配置文件的 owner 是 root,而不是新用户)"
|
||||||
read -p "y for yes, anything else for no >> " YesOrNo
|
read -p "y for yes, anything else for no >> " YesOrNo
|
||||||
if [ $YesOrNo = 'y' ]
|
if [ $YesOrNo = 'y' ]
|
||||||
then
|
then
|
||||||
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser
|
source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
@ -5,7 +5,7 @@ then
|
|||||||
SourcePath=$1
|
SourcePath=$1
|
||||||
else
|
else
|
||||||
echo "Configure private home settings"
|
echo "Configure private home settings"
|
||||||
echo "Usage: setup.sh [Config-Source-Path] [User-Home-Path]"
|
echo "Usage: setup.sh [Config-Source-Path] [User-Home-Path] [--AdotMode]"
|
||||||
read -p "Enter config source path (leave blank for [/Users/luk.lu]/faronear/fon/sysconfig/nixhome) >> " SourcePath
|
read -p "Enter config source path (leave blank for [/Users/luk.lu]/faronear/fon/sysconfig/nixhome) >> " SourcePath
|
||||||
if [ ! $SourcePath ]
|
if [ ! $SourcePath ]
|
||||||
then
|
then
|
||||||
@ -37,13 +37,18 @@ then
|
|||||||
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
|
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
|
||||||
for homescript in $homescriptlist
|
for homescript in $homescriptlist
|
||||||
do
|
do
|
||||||
echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..."
|
|
||||||
rm -fr $homescript.backup
|
rm -fr $homescript.backup
|
||||||
mv $homescript $homescript.backup
|
mv $homescript $homescript.backup
|
||||||
|
if [ $3 = '--AdotMode' ] # $3 通常不输入,所以默认是拷贝模式
|
||||||
|
then
|
||||||
|
echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..."
|
||||||
|
ln -s $SourcePath/$homescript $HomePath
|
||||||
|
else
|
||||||
|
echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..."
|
||||||
cp -r $SourcePath/$homescript $HomePath
|
cp -r $SourcePath/$homescript $HomePath
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
read -p "Linking .ssh/authorized_keys? Enter l to link or anything else to ignore >> " linkSshKeys
|
if [ $3 = '--AdotMode' ] # $3 通常不输入,所以默认是不给其他用户链接到 authorized_keys
|
||||||
if [ $linkSshKeys == "l" ]
|
|
||||||
then
|
then
|
||||||
echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..."
|
echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..."
|
||||||
mkdir -p $HomePath/.ssh
|
mkdir -p $HomePath/.ssh
|
||||||
|
Loading…
Reference in New Issue
Block a user