qemush : ne pas cd avant l'exécution du script

This commit is contained in:
Hippolyte Chauvin 2023-12-05 22:56:54 +01:00
parent c3f9ea310f
commit 6a7c58fc05

View file

@ -7,15 +7,13 @@ exec_as() {
if [ "$(whoami)" != "$user" ]; then if [ "$(whoami)" != "$user" ]; then
exec sudo -u "$user" "$0" "$@" exec sudo -u "$user" "$0" "$@"
else
cd || exit
fi fi
} }
exec_as qemu "$@" exec_as qemu "$@"
bin="${HOME}/bin" bin="${HOME}/bin"
images=images images="${HOME}/images"
PATH="${bin}:${PATH}" PATH="${bin}:${PATH}"
EDITOR="${EDITOR:-nvim}" EDITOR="${EDITOR:-nvim}"
alias ls='ls --color=auto' alias ls='ls --color=auto'
@ -106,6 +104,7 @@ public_rm() {
} }
public_shell() { public_shell() {
cd || return
exec bash -i exec bash -i
} }
@ -116,7 +115,6 @@ public_cat() {
public_add() { public_add() {
trap return EXIT trap return EXIT
set -e set -e
cd -
local name="${2:-$(basename "$1")}" local name="${2:-$(basename "$1")}"
cp -v -i -- "$1" "${bin}/${2}" cp -v -i -- "$1" "${bin}/${2}"
chmod 740 "${bin}/${name}" chmod 740 "${bin}/${name}"