qemush : ajout de la fonction add

This commit is contained in:
Hippolyte Chauvin 2023-12-04 23:19:24 +01:00
parent 519f9d415f
commit 07b317c133

View file

@ -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 <disk name> - delete disk image
${name} shell - start a shell as user qemu
${name} help - show this help
${name} add <path to script> - 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