u
This commit is contained in:
		
							parent
							
								
									0ddecd40c3
								
							
						
					
					
						commit
						2782c12fb1
					
				| @ -36,7 +36,7 @@ echo | |||||||
| # 注意,在这里为新用户创建的配置文件,主人是 root,而不是新用户 | # 注意,在这里为新用户创建的配置文件,主人是 root,而不是新用户 | ||||||
| if [ $NewUser = 'adot' ] | if [ $NewUser = 'adot' ] | ||||||
| then | 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 | 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 | ||||||
|  | |||||||
| @ -35,11 +35,12 @@ if [ -d $SourcePath ] && [ -d $HomePath ] | |||||||
| then | then | ||||||
|   pushd $HomePath |   pushd $HomePath | ||||||
|   homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore" |   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 |   for homescript in $homescriptlist | ||||||
|   do |   do | ||||||
|     rm -fr $homescript.backup |     rm -fr $homescript.backup | ||||||
|     mv $homescript $homescript.backup |     mv $homescript $homescript.backup | ||||||
|     if [ $3 = '--AdotMode' ] # $3 通常不输入,所以默认是拷贝模式 |     if [ $CopyOrLinkScripts = 'l' ] | ||||||
|     then |     then | ||||||
|       echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." |       echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." | ||||||
|       ln -s $SourcePath/$homescript $HomePath |       ln -s $SourcePath/$homescript $HomePath | ||||||
| @ -48,7 +49,8 @@ then | |||||||
|       cp -r $SourcePath/$homescript $HomePath |       cp -r $SourcePath/$homescript $HomePath | ||||||
|     fi |     fi | ||||||
|   done |   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 |   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 | ||||||
| @ -59,6 +61,11 @@ then | |||||||
|       mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup |       mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup | ||||||
|     fi |     fi | ||||||
|     ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys |     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 |   fi | ||||||
|   popd |   popd | ||||||
| else | else | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user