27 lines
		
	
	
		
			709 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			27 lines
		
	
	
		
			709 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
								 | 
							
								#!/usr/bin/env python3
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import os
							 | 
						||
| 
								 | 
							
								import sys
							 | 
						||
| 
								 | 
							
								import pathlib 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import os
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								os.chdir("/root")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
							 | 
						||
| 
								 | 
							
								sys.path.insert(0, "/root/bin")
							 | 
						||
| 
								 | 
							
								sys.path.insert(0, "/root/bin/local/bin")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if not pathlib.Path(".welcome.txt").exists():
							 | 
						||
| 
								 | 
							
								    os.system("python3 -m venv --prompt '' .venv")
							 | 
						||
| 
								 | 
							
								    os.system("cp -r /opt/bootstrap/root/.* /root")
							 | 
						||
| 
								 | 
							
								    os.system("cp /opt/bootstrap/.welcome.txt /root/.welcome.txt")
							 | 
						||
| 
								 | 
							
								    pathlib.Path(".bashrc").write_text(pathlib.Path(".bashrc").read_text() + "\n" + "source .venv/bin/activate")
							 | 
						||
| 
								 | 
							
								os.environ["SNEK"] = "1"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if pathlib.Path(".welcome.txt").exists():
							 | 
						||
| 
								 | 
							
								    with open(".welcome.txt") as f:
							 | 
						||
| 
								 | 
							
								        print(f.read())
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								os.system("bash")
							 |