u
This commit is contained in:
		
							parent
							
								
									4cbc029412
								
							
						
					
					
						commit
						0ddecd40c3
					
				| @ -34,10 +34,14 @@ chmod a-w /etc/sudoers.d/${NewUser//./-} | ||||
| echo | ||||
| 
 | ||||
| # 注意,在这里为新用户创建的配置文件,主人是 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,而不是新用户)" | ||||
|   read -p "y for yes, anything else for no >> " YesOrNo | ||||
|   if [ $YesOrNo = 'y' ] | ||||
|   then | ||||
|     source /faronear/fon/sysconfig/home-config.sh /faronear/fon/sysconfig/nixhome /home/$NewUser | ||||
|   fi | ||||
| 
 | ||||
| fi | ||||
|  | ||||
| @ -5,7 +5,7 @@ then | ||||
|   SourcePath=$1 | ||||
| else | ||||
|   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 | ||||
|   if [ ! $SourcePath ] | ||||
|   then | ||||
| @ -37,13 +37,18 @@ then | ||||
|   homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore" | ||||
|   for homescript in $homescriptlist | ||||
|   do | ||||
|     echo "--- Copying $SourcePath/$homescript to $HomePath/$homescript ..." | ||||
|     rm -fr $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 | ||||
|     fi | ||||
|   done | ||||
|   read -p "Linking .ssh/authorized_keys? Enter l to link or anything else to ignore >> " linkSshKeys | ||||
|   if [ $linkSshKeys == "l" ] | ||||
|   if [ $3 = '--AdotMode' ] # $3 通常不输入,所以默认是不给其他用户链接到 authorized_keys | ||||
|   then | ||||
|     echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." | ||||
|     mkdir -p $HomePath/.ssh | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user