From 7a089aca652a7ff88b03d1b4097679c357e3add9 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Tue, 14 Feb 2023 11:27:05 -0600 Subject: [PATCH] Add distrobox-exported executables --- emacs | 24 ++++++++++++++++++++++++ gumssh | 2 +- nmap | 24 ++++++++++++++++++++++++ offlineimap | 24 ++++++++++++++++++++++++ wireshark | 24 ++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100755 emacs create mode 100755 nmap create mode 100755 offlineimap create mode 100755 wireshark diff --git a/emacs b/emacs new file mode 100755 index 0000000..1f6ef01 --- /dev/null +++ b/emacs @@ -0,0 +1,24 @@ +#!/bin/sh +# distrobox_binary +# name: default +if [ ! -f /run/.containerenv ] && [ ! -f /.dockerenv ]; then + command="/bin/distrobox-enter -n default -- /bin/emacs " + + for arg in "$@"; do + if echo "${arg}" | grep -Eq "'|\""; then + command="${command} \ + $(echo "${arg}" | sed 's|\\|\\\\|g' | + sed 's| |\\ |g' | + sed 's|\$|\\\$|g' | + sed "s|'|\\\'|g" | + sed 's|"|\\\"|g')" + elif echo "${arg}" | grep -q "'"; then + command="${command} \"${arg}\"" + else + command="${command} '${arg}'" + fi + done + eval ${command} +else + /bin/emacs "$@" +fi diff --git a/gumssh b/gumssh index 6b1ae73..d0c0b0d 100755 --- a/gumssh +++ b/gumssh @@ -47,5 +47,5 @@ selection=$(printf "%s\n" "${logins[@]}" | gum choose --limit=1) # If $selection is non-empty, pass it to the ssh -X command. if test -n "${selection}"; then - ssh -X "${selection}" + autossh -M 0 "${selection}" -X fi diff --git a/nmap b/nmap new file mode 100755 index 0000000..edf03ee --- /dev/null +++ b/nmap @@ -0,0 +1,24 @@ +#!/bin/sh +# distrobox_binary +# name: default_root +if [ ! -f /run/.containerenv ] && [ ! -f /.dockerenv ]; then + command="/bin/distrobox-enter --root -n default_root -- /bin/nmap " + + for arg in "$@"; do + if echo "${arg}" | grep -Eq "'|\""; then + command="${command} \ + $(echo "${arg}" | sed 's|\\|\\\\|g' | + sed 's| |\\ |g' | + sed 's|\$|\\\$|g' | + sed "s|'|\\\'|g" | + sed 's|"|\\\"|g')" + elif echo "${arg}" | grep -q "'"; then + command="${command} \"${arg}\"" + else + command="${command} '${arg}'" + fi + done + eval ${command} +else + /bin/nmap "$@" +fi diff --git a/offlineimap b/offlineimap new file mode 100755 index 0000000..597f294 --- /dev/null +++ b/offlineimap @@ -0,0 +1,24 @@ +#!/bin/sh +# distrobox_binary +# name: default_root +if [ ! -f /run/.containerenv ] && [ ! -f /.dockerenv ]; then + command="/bin/distrobox-enter --root -n default_root -- /bin/offlineimap " + + for arg in "$@"; do + if echo "${arg}" | grep -Eq "'|\""; then + command="${command} \ + $(echo "${arg}" | sed 's|\\|\\\\|g' | + sed 's| |\\ |g' | + sed 's|\$|\\\$|g' | + sed "s|'|\\\'|g" | + sed 's|"|\\\"|g')" + elif echo "${arg}" | grep -q "'"; then + command="${command} \"${arg}\"" + else + command="${command} '${arg}'" + fi + done + eval ${command} +else + /bin/offlineimap "$@" +fi diff --git a/wireshark b/wireshark new file mode 100755 index 0000000..d801708 --- /dev/null +++ b/wireshark @@ -0,0 +1,24 @@ +#!/bin/sh +# distrobox_binary +# name: default_root +if [ ! -f /run/.containerenv ] && [ ! -f /.dockerenv ]; then + command="/bin/distrobox-enter --root -n default_root -- /bin/wireshark " + + for arg in "$@"; do + if echo "${arg}" | grep -Eq "'|\""; then + command="${command} \ + $(echo "${arg}" | sed 's|\\|\\\\|g' | + sed 's| |\\ |g' | + sed 's|\$|\\\$|g' | + sed "s|'|\\\'|g" | + sed 's|"|\\\"|g')" + elif echo "${arg}" | grep -q "'"; then + command="${command} \"${arg}\"" + else + command="${command} '${arg}'" + fi + done + eval ${command} +else + /bin/wireshark "$@" +fi