scripts
This commit is contained in:
		| @@ -1,33 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -e | ||||
|  | ||||
| if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then | ||||
| 	echo "bad args" >&2 | ||||
| 	exit 1 | ||||
| fi  | ||||
|  | ||||
| DEST=$(realpath "$2") | ||||
| cd "$1" | ||||
|  | ||||
| #shellcheck disable=SC2016 | ||||
| find . \ | ||||
| 	-type f \ | ||||
| 	-not -path '*/.*' \ | ||||
| 	-path "$3" | \ | ||||
| 		xargs -0 -d \\n -n 1 sh -c "mkdir -p $DEST/\$(dirname \"\$1\")" sh | ||||
|  | ||||
| #shellcheck disable=SC2016 | ||||
| find . \ | ||||
| 	-type f \ | ||||
| 	-not -path '*/.*' \ | ||||
| 	-path "$3" \ | ||||
| 	-printf "$(pwd)/%P\n$DEST/%P\n" | \ | ||||
| 		xargs -0 -d \\n -n 2 sh -c "$4" sh | ||||
|  | ||||
|  | ||||
| #for rel in $(find . -type f -name *.gpg); do | ||||
| #	DESTFILE=$(echo $DEST/$rel | sed 's/\.[^.]*$//') | ||||
|  #      	[ -f "$DESTFILE" ] && continue	 | ||||
| #	mkdir -p "$(dirname "$DESTFILE")" | ||||
| #	gpg --output "$DESTFILE" --decrypt "$rel" | ||||
| #done | ||||
| @@ -1,13 +0,0 @@ | ||||
| #!/bin/bash | ||||
| set -e | ||||
|  | ||||
| if [ -z "$PASSPHRASE" ]; then | ||||
| 	read -srp "Password: " PASSPHRASE | ||||
| 	echo | ||||
| fi | ||||
| export PASSPHRASE | ||||
|  | ||||
| bash ~/.local/bin/alg/file-tree-apply.sh "$1" "$2" '*.gpg' \ | ||||
| 	'if [ ! -f "$2" ]; then gpg --decrypt "$1" | gpg --symmetric --output "$2" --passphrase "$PASSPHRASE" --batch --yes; fi' | ||||
|  | ||||
| echo ok | ||||
							
								
								
									
										26
									
								
								arch-user/bin/qemu/arch.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								arch-user/bin/qemu/arch.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| if [ -z "$1" ]; then | ||||
| 	echo Error: no name >&2 | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
| if ! screen -ls | grep -q qemu-arch; then | ||||
| 	screen-detach "qemu-arch-$1" \ | ||||
| 		qemu-system-x86_64 "$HOME/lfs/vm/$1" \ | ||||
| 			-display none \ | ||||
| 			-m 2G \ | ||||
| 			-accel kvm -cpu host \ | ||||
| 			-net nic -net user,hostfwd=tcp:127.0.0.1:2222-:22 | ||||
| fi | ||||
|  | ||||
| screen -ls | grep qemu-arch | ||||
| if ! screen -ls | grep -q "qemu-arch-$1"; then | ||||
| 	echo Error: another kind is running >&2 | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
| while true; do | ||||
| 	ssh arch@127.0.0.1 -p 2222 && break | ||||
| 	sleep 5 | ||||
| done | ||||
							
								
								
									
										9
									
								
								arch-user/bin/screen/detach.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								arch-user/bin/screen/detach.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| session_name="$1" | ||||
| shift | ||||
| tmpfile=$(mktemp) | ||||
| cmd="$(printf "%q " "$@")" | ||||
| qcmd="$(printf "%q " "$cmd")" | ||||
| echo -e ". ~/.bashrc\nhistory -s "$qcmd"\necho "$qcmd"\n$cmd && exit" > "$tmpfile" | ||||
| screen -S "$session_name" -dm bash --init-file "$tmpfile" | ||||
		Reference in New Issue
	
	Block a user