From 07b317c1333696d3dd44ce992b1e61e19fc5b8fe Mon Sep 17 00:00:00 2001 From: Hippolyte Chauvin Date: Mon, 4 Dec 2023 23:19:24 +0100 Subject: [PATCH] qemush : ajout de la fonction add --- bin/qemush | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/qemush b/bin/qemush index 8c11e7c..a819e3f 100755 --- a/bin/qemush +++ b/bin/qemush @@ -14,9 +14,9 @@ exec_as() { exec_as qemu "$@" -bin=bin +bin="${HOME}/bin" images=images -PATH="./${bin}:${PATH}" +PATH="${bin}:${PATH}" EDITOR="${EDITOR:-nvim}" [ -t 1 ] && alias cat='source-highlight -o STDOUT -f esc' alias ls='ls --color=auto' @@ -44,6 +44,7 @@ ${name}: usage: ${name} diskrm - delete disk image ${name} shell - start a shell as user qemu ${name} help - show this help + ${name} add - add a launching script from this PATH EOF } @@ -108,6 +109,17 @@ public_cat() { exec cat "${bin}/${1}" } +public_add() { + trap return EXIT + set -e + cd - + local name="${2:-$(basename "$1")}" + cp -v -i -- "$1" "${bin}/${2}" + chmod 740 "${bin}/${name}" + set +e + trap - EXIT +} + function="$1" shift