mirror of
				https://github.com/flynx/proxmox-utils.git
				synced 2025-10-31 12:10:07 +00:00 
			
		
		
		
	testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									dfccbb0819
								
							
						
					
					
						commit
						7dda3a28e7
					
				
							
								
								
									
										11
									
								
								.pct-helpers
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								.pct-helpers
									
									
									
									
									
								
							| @ -205,27 +205,30 @@ xreadpass(){ | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| # Wait for /etc/inithooks.conf to be generated then cleared | ||||
| # | ||||
| # 	tklWaitForSetup | ||||
| # | ||||
| # for tkl inithooks doc see: | ||||
| # 	https://www.turnkeylinux.org/docs/inithooks | ||||
| tklWaitForSetup(){ | ||||
| 	printf "# TKL setup, this may take a while" | ||||
| 	if [ -z $DRY_RUN ] ; then | ||||
| 		while ! $(lxc-attach $ID -- test -e /etc/inithooks.conf) ; do | ||||
| 			printf '.' | ||||
| 			sleep 5 | ||||
| 			sleep ${TIMEOUT:=5} | ||||
| 		done | ||||
| 		printf '+' | ||||
| 		sleep 5 | ||||
| 		sleep ${TIMEOUT:=5} | ||||
| 		while ! [[ $(lxc-attach $ID -- cat /etc/inithooks.conf | wc -c) < 2 ]] ; do | ||||
| 			printf '.' | ||||
| 			sleep 5 | ||||
| 			sleep ${TIMEOUT:=5} | ||||
| 		done | ||||
| 	else | ||||
| 		printf '.+..' | ||||
| 	fi | ||||
| 	printf 'ready.\n' | ||||
| 	sleep 5 | ||||
| 	sleep ${TIMEOUT:=5} | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -51,6 +51,7 @@ OPTS_STAGE_1="\ | ||||
| 	--storage local-lvm \ | ||||
| 	--rootfs local-lvm:$DRIVE \ | ||||
| 	--unprivileged 1 \ | ||||
| 	--features nesting=1 \ | ||||
| 	${PCT_EXTRA} \ | ||||
| " | ||||
| 
 | ||||
|  | ||||
| @ -49,7 +49,7 @@ OPTS_STAGE_1="\ | ||||
| 	--storage local-lvm \ | ||||
| 	--rootfs local-lvm:$DRIVE \ | ||||
| 	--unprivileged 1 \ | ||||
| 	--features nesting=1 | ||||
| 	--features nesting=1 \ | ||||
| 	${PCT_EXTRA} \ | ||||
| " | ||||
| 
 | ||||
| @ -68,29 +68,6 @@ getLatestTemplate '.*-turnkey-nextcloud' TEMPLATE | ||||
| pctCreate $ID "$TEMPLATE" "$OPTS_STAGE_1" "$PASS" | ||||
| sleep ${TIMEOUT:=5} | ||||
| 
 | ||||
| # hooking into tkl init process: | ||||
| # 	- wait for /etc/inithooks.conf to be generated by: | ||||
| # 		/usr/lib/inithooks/firstboot.d/29preseed | ||||
| # 	  this file existion would mean that the first stage of setup is | ||||
| # 	  done and we can do: | ||||
| # 	  	lxc-attach $ID -- bash --login exit | ||||
| # 	  to launch interactive setup... | ||||
| # 	  XXX can we get console/log output while poling??? | ||||
| # 	- inject a script into the chain to do our stuff | ||||
| # 	  Q: can we reuse tkl's scripts??? | ||||
| # | ||||
| # 	* another strategy would be generate our own inithooks.conf but  | ||||
| # 	  this would require us to mount the ct volume before first boot... | ||||
| # 	  see: | ||||
| # 	  	https://forum.proxmox.com/threads/pct-push-when-lxc-is-offline.116786/ | ||||
| # 	* might be usefull to do both to: | ||||
| # 		- maximize compatibility / change tolerance (tkl ui) (???) | ||||
| # 		- skip dialogs we do not use... | ||||
| # 		  ...i.e. poll-patch-ui | ||||
| # | ||||
| # for tkl inithooks doc see: | ||||
| # 	https://www.turnkeylinux.org/docs/inithooks | ||||
| 
 | ||||
| tklWaitForSetup | ||||
| 
 | ||||
| echo "# Starting TKL UI..." | ||||
| @ -98,14 +75,16 @@ echo "# Starting TKL UI..." | ||||
| 
 | ||||
| echo "# Updating config..." | ||||
| # add gate IP to trusted_proxies... | ||||
| @ lxc-attach $ID -- sed -i \ | ||||
| 	-e "/trusted_domains/i\  'trusted_proxies' =>\n  array (\n    '${GATE_LAN_IP}/32',\n  )," \ | ||||
| 	/var/www/nextcloud/config/config.php | ||||
| @ lxc-attach $ID -- bash -c "\ | ||||
| 	sed -i \ | ||||
| 		-e \"/trusted_domains/i\  'trusted_proxies' =>\n  array (\n    '${GATE_LAN_IP}/32',\n  ),\" \ | ||||
| 		/var/www/nextcloud/config/config.php" | ||||
| # add self IP to trusted_domains -- enable setup from local network... | ||||
| IP=${DRY_RUN:=$(lxc-attach $ID -- hostname -I)} | ||||
| @ lxc-attach $ID -- sed -z -i \ | ||||
| 	-e "s/\(trusted_domains[^)]*\)/\1  2 => '${IP/ *}',\n  /" \ | ||||
| 	/var/www/nextcloud/config/config.php | ||||
| @ lxc-attach $ID -- bash -c "\ | ||||
| 	sed -z -i \ | ||||
| 		-e \"s/\(trusted_domains[^)]*\)/\1  2 => '${IP/ *}',\n  /\" \ | ||||
| 		/var/www/nextcloud/config/config.php" | ||||
| 
 | ||||
| echo "# Copying assets..." | ||||
| @ pct-push-r $ID ./assets / | ||||
|  | ||||
| @ -50,6 +50,7 @@ OPTS_STAGE_1="\ | ||||
| 	--storage local-lvm \ | ||||
| 	--rootfs local-lvm:$DRIVE \ | ||||
| 	--unprivileged 1 \ | ||||
| 	--features nesting=1 \ | ||||
| 	${PCT_EXTRA} \ | ||||
| " | ||||
| 
 | ||||
|  | ||||
| @ -50,6 +50,7 @@ OPTS_STAGE_1="\ | ||||
| 	--storage local-lvm \ | ||||
| 	--rootfs local-lvm:$DRIVE \ | ||||
| 	--unprivileged 1 \ | ||||
| 	--features nesting=1 \ | ||||
| 	${PCT_EXTRA} \ | ||||
| " | ||||
| 
 | ||||
|  | ||||
| @ -49,6 +49,7 @@ OPTS_STAGE_1="\ | ||||
| 	--storage local-lvm \ | ||||
| 	--rootfs local-lvm:$DRIVE \ | ||||
| 	--unprivileged 1 \ | ||||
| 	--features nesting=1 \ | ||||
| 	${PCT_EXTRA} \ | ||||
| " | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user