diff --git a/arch-root/install.sh b/arch-root/install.sh index bcc72c4..e698e6a 100755 --- a/arch-root/install.sh +++ b/arch-root/install.sh @@ -6,7 +6,7 @@ PACKAGES=( linux base linux-firmware lvm2 sudo polkit # base pulseaudio pulseaudio-bluetooth bluez bluez-utils networkmanager udisks2 # device management - openssh man-db htop # admin utils + openssh sysstat screen man-db # system nodejs dash jq # runtime qemu-system-x86 # virt diff --git a/arch-user/bin/alg/file-tree-apply.sh b/arch-user/bin/alg/file-tree-apply.sh deleted file mode 100755 index 8028f17..0000000 --- a/arch-user/bin/alg/file-tree-apply.sh +++ /dev/null @@ -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 diff --git a/arch-user/bin/run.sh b/arch-user/bin/bemenu/run.sh similarity index 100% rename from arch-user/bin/run.sh rename to arch-user/bin/bemenu/run.sh diff --git a/arch-user/bin/gpg/reencrypt-to-sym.sh b/arch-user/bin/gpg/reencrypt-to-sym.sh deleted file mode 100755 index a3e7e9d..0000000 --- a/arch-user/bin/gpg/reencrypt-to-sym.sh +++ /dev/null @@ -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 diff --git a/arch-user/bin/qemu/arch.sh b/arch-user/bin/qemu/arch.sh new file mode 100755 index 0000000..e7ff077 --- /dev/null +++ b/arch-user/bin/qemu/arch.sh @@ -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 diff --git a/arch-user/bin/screen/detach.sh b/arch-user/bin/screen/detach.sh new file mode 100755 index 0000000..8f3f4bd --- /dev/null +++ b/arch-user/bin/screen/detach.sh @@ -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" diff --git a/arch-user/config/bash/bashrc b/arch-user/config/bash/bashrc index 2cb268b..b78f326 100644 --- a/arch-user/config/bash/bashrc +++ b/arch-user/config/bash/bashrc @@ -9,3 +9,5 @@ alias grep='grep --color=auto' export EDITOR=vim PS1='\[\033[38;2;153;136;255m\]\u@\h:\W\$\[\033[0m\]\[\e[0;91m\]${?#0}\[\e[0m\] ' + + diff --git a/arch-user/config/pass/env.sh b/arch-user/config/pass/env.sh index 5b77089..638856f 100755 --- a/arch-user/config/pass/env.sh +++ b/arch-user/config/pass/env.sh @@ -1,4 +1,3 @@ #!/bin/sh - export PASSWORD_STORE_DIR="$HOME/know/id" export PASSWORD_STORE_GENERATED_LENGTH=16 diff --git a/arch-user/config/readline/env.sh b/arch-user/config/readline/env.sh index af4cbff..33c51bf 100755 --- a/arch-user/config/readline/env.sh +++ b/arch-user/config/readline/env.sh @@ -1,3 +1,2 @@ #!/bin/sh - export INPUTRC="$HOME/.config/readline/inputrc" diff --git a/arch-user/config/screen/env.sh b/arch-user/config/screen/env.sh new file mode 100755 index 0000000..b1b1223 --- /dev/null +++ b/arch-user/config/screen/env.sh @@ -0,0 +1,2 @@ +#!/bin/sh +export SCREENRC="$HOME/.config/screen/screenrc" diff --git a/arch-user/config/screen/screenrc b/arch-user/config/screen/screenrc new file mode 100644 index 0000000..cd1e06b --- /dev/null +++ b/arch-user/config/screen/screenrc @@ -0,0 +1 @@ +termcapinfo * ti@:te@ diff --git a/arch-user/config/sway/config.tmpl b/arch-user/config/sway/config.tmpl index 029a21b..48e1889 100644 --- a/arch-user/config/sway/config.tmpl +++ b/arch-user/config/sway/config.tmpl @@ -135,7 +135,7 @@ bindsym --to-code { # basic scripts $mod+Colon exec ~/.local/bin/sway/command-mode.sh $mod+Return exec footclient - $mod+Space exec run.sh + $mod+Space exec ~/.local/bin/bemenu/run.sh } ############################################## diff --git a/arch-user/install.sh b/arch-user/install.sh index cd06b61..7fb19f5 100755 --- a/arch-user/install.sh +++ b/arch-user/install.sh @@ -48,7 +48,7 @@ mkdir -p "${USER_DIRS[@]}" ########## scripts ############# cp -rf bin/* ~/.local/bin -LN_EXCLUDE_DIRS=(i3blocks bemenu) +LN_EXCLUDE_DIRS=(i3blocks bemenu sway) ln_exclude_dirs_cmp=" ${LN_EXCLUDE_DIRS[*]} " for sdir in bin/*; do @@ -59,7 +59,7 @@ for sdir in bin/*; do -exec rm {} \; #shellcheck disable=SC2016 find ~/.local/bin/"$sdir" -maxdepth 1 -type f -perm -u+rwx | \ - xargs -0 -d \\n -n 1 sh -c 'ln -s "$1" "/$HOME/.local/bin/$(basename "$(dirname "$1")")-${1##*/}"' sh + xargs -0 -d \\n -n 1 sh -c 'ln -s "$1" "/$HOME/.local/bin/$(basename "$(dirname "$1")")-$(basename "$1" .sh)"' sh done ################################ diff --git a/linux-compat/home/env.sh b/linux-compat/home/env.sh new file mode 100755 index 0000000..3406e6f --- /dev/null +++ b/linux-compat/home/env.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +export BASIC_PACMAN="vim less"