change / to | in sed
This commit is contained in:
		
							parent
							
								
									f9fe9abb39
								
							
						
					
					
						commit
						0b5aa51682
					
				| @ -1,5 +1,6 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
|  | echo "in [RepoRoot]/*/*/hooks/post-receive & pre-receive, gogs is hard-coded with full path such as /faronear/git/gogs, you need to replace it if the path is changed." | ||||||
| read -p "Enter old hook path: >> " OLDPATH | read -p "Enter old hook path: >> " OLDPATH | ||||||
| read -p "Enter new hook path: >> " NEWPATH | read -p "Enter new hook path: >> " NEWPATH | ||||||
| read -p "Enter repository root path: >> " REPOROOT | read -p "Enter repository root path: >> " REPOROOT | ||||||
|  | |||||||
| @ -49,14 +49,14 @@ chown $NewUser:$NewUser /home/$NewUser | |||||||
| chmod 700 /home/$NewUser | chmod 700 /home/$NewUser | ||||||
| # emacs /etc/passwd | # emacs /etc/passwd | ||||||
| # 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 | ||||||
| sed -i "s/\/home\/$NewUser:$/\/home\/$NewUser:\/bin\/bash/g" /etc/passwd | sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash/g" /etc/passwd | ||||||
| 
 | 
 | ||||||
| echo "<<< Allow sudo without password: %sudo ALL=(ALL:ALL) NOPASSWD:ALL" | echo "<<< Allow sudo without password: %sudo ALL=(ALL:ALL) NOPASSWD:ALL" | ||||||
| chmod o+w /etc/sudoers | chmod o+w /etc/sudoers | ||||||
| # emacs /etc/sudoers | # emacs /etc/sudoers | ||||||
| sed -i "s/%sudo\s\+ALL=(ALL:ALL)\sALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/g" /etc/sudoers | sed -i "s|%sudo\s\+ALL=(ALL:ALL)\sALL|%sudo\tALL=(ALL:ALL) NOPASSWD:ALL|g" /etc/sudoers | ||||||
| chmod o-w /etc/sudoers | chmod o-w /etc/sudoers | ||||||
| 
 | 
 | ||||||
| echo "<<< Disallow root login: #PermitRootLogin yes" | echo "<<< Disallow root login: #PermitRootLogin yes" | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								serve-git.sh
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								serve-git.sh
									
									
									
									
									
								
							| @ -1,13 +0,0 @@ | |||||||
| echo 'Starting gogs git service in screen...' |  | ||||||
| #screen -dmS gogs |  | ||||||
| #screen -S gogs -X stuff "/faronear/gogs/gogs web\n" |  | ||||||
| cd /faronear/git/gogs # 如果在 /faronear/git 中运行 ./gogs/gogs,导致额外生成 /faronear/git/data 目录。 |  | ||||||
| sudo pm2 start -x './gogs' -n git.gogs -- web # sudo it so that pm2 list shows it as root |  | ||||||
| cd /faronear |  | ||||||
| 
 |  | ||||||
| echo 'Starting http2https web service in pm2...' |  | ||||||
| cd /faronear/git/git.faronear.org |  | ||||||
| sudo pm2 start server.js --name git.http # sudo it so that pm2 list shows it as root |  | ||||||
| cd /faronear |  | ||||||
| 
 |  | ||||||
| echo 'Done!' |  | ||||||
							
								
								
									
										7
									
								
								serve-gitea.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								serve-gitea.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | echo '>>>> Starting gitea ...' | ||||||
|  | pushd /faronear/git/gitea | ||||||
|  | # sudo it so that pm2 list shows it as root | ||||||
|  | sudo pm2 start -x './gitea' --name gitea -- web | ||||||
|  | popd | ||||||
|  | 
 | ||||||
|  | echo '>>>> Started gitea successfully!' | ||||||
							
								
								
									
										19
									
								
								serve-gogs.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								serve-gogs.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | # 服务化方案1: screen | ||||||
|  | #echo '>>> Starting gogs in screen ...' | ||||||
|  | #screen -dmS gogs | ||||||
|  | #screen -S gogs -X stuff "/faronear/gogs/gogs web\n" | ||||||
|  | 
 | ||||||
|  | # 服务化方案2: pm2 | ||||||
|  | echo '>>>> Starting gogs in pm2 ...' | ||||||
|  | pushd /faronear/git/gogs # 如果在 /faronear/git 中运行 ./gogs/gogs,导致额外生成 /faronear/git/data 目录。 | ||||||
|  | # sudo it so that pm2 list shows it as root | ||||||
|  | sudo pm2 start -x './gogs' --name git.gogs -- web | ||||||
|  | popd | ||||||
|  | 
 | ||||||
|  | echo '>>>> Starting http2https in pm2 ...' | ||||||
|  | pushd /faronear/git/git.faronear.org | ||||||
|  | # sudo it so that pm2 list shows it as root | ||||||
|  | sudo pm2 start ./node_modules/sol.webserver/server.js --name git.http2https | ||||||
|  | popd | ||||||
|  | 
 | ||||||
|  | echo '>>>> Started gogs successfully!' | ||||||
| @ -1,9 +1,9 @@ | |||||||
| echo 'Starting yapi ...' | echo 'Starting yapi ...' | ||||||
| sudo pm2 start "/faronear/fon/yapi/vendors/server/app.js" --name yapi # sudo it so that pm2 list shows it as root | sudo pm2 start "/faronear/fon/yapi/vendors/server/app.js" --name yapi # sudo it so that pm2 list shows it as root | ||||||
| 
 | 
 | ||||||
| echo 'Starting http2https web service...' | echo 'Starting https2http proxy ...' | ||||||
| cd /faronear/fon/yapi.faronear.org | pushd /faronear/fon/yapi.faronear.org | ||||||
| sudo pm2 start server.js --name yapi.https2http # sudo it so that pm2 list shows it as root | sudo pm2 start ./node_modules/sol.webserver/server.js --name yapi.https2http # sudo it so that pm2 list shows it as root | ||||||
| cd .. | popd | ||||||
| 
 | 
 | ||||||
| echo 'Done!' | echo 'Started yapi + https2http successfully!' | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user