qemush : suppression variables qui contenaient les répertoires des homedirs de qemush
This commit is contained in:
parent
8e5346a7f2
commit
ba3547d770
1 changed files with 16 additions and 14 deletions
30
bin/qemush
30
bin/qemush
|
@ -15,13 +15,8 @@ exec_as() {
|
||||||
# Exec the script as qemu
|
# Exec the script as qemu
|
||||||
exec_as qemu "$@"
|
exec_as qemu "$@"
|
||||||
|
|
||||||
# Directories used in the program
|
|
||||||
bin="${HOME}/launchers"
|
|
||||||
images="${HOME}/disks"
|
|
||||||
sockets="${HOME}/sockets"
|
|
||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
PATH="${bin}:${HOME}/bin:${PATH}"
|
PATH="${HOME}/launchers:${HOME}/bin:${PATH}"
|
||||||
EDITOR="${EDITOR:-nvim}"
|
EDITOR="${EDITOR:-nvim}"
|
||||||
export QEMUSH_NAME
|
export QEMUSH_NAME
|
||||||
|
|
||||||
|
@ -93,13 +88,13 @@ public_watch() {
|
||||||
# List running virtual machines
|
# List running virtual machines
|
||||||
public_active() {
|
public_active() {
|
||||||
echo "Running machines:"
|
echo "Running machines:"
|
||||||
exec ls -t "$sockets"
|
exec ls -t sockets
|
||||||
}
|
}
|
||||||
|
|
||||||
# List available virtual machines entrypoints
|
# List available virtual machines entrypoints
|
||||||
public_ls() {
|
public_ls() {
|
||||||
echo "Available machines:"
|
echo "Available machines:"
|
||||||
exec ls "$bin"
|
exec ls launchers
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a copy-on-write disk for a virtual machine
|
# Create a copy-on-write disk for a virtual machine
|
||||||
|
@ -121,19 +116,20 @@ public_diskrm() {
|
||||||
# List available disks
|
# List available disks
|
||||||
public_diskls() {
|
public_diskls() {
|
||||||
echo "Available disks:"
|
echo "Available disks:"
|
||||||
exec ls "$images"
|
exec ls disks
|
||||||
}
|
}
|
||||||
|
|
||||||
# Edit a virtual machine entrypoint with a text editor
|
# Edit a virtual machine entrypoint with a text editor
|
||||||
public_edit() {
|
public_edit() {
|
||||||
local file="${bin}/${1}"
|
local file="launchers/${1}"
|
||||||
|
|
||||||
"$EDITOR" "$file"
|
"$EDITOR" "$file"
|
||||||
[ -f "$file" ] && exec chmod u+x "$file"
|
[ -f "$file" ] && exec chmod u+x "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete a virtual machine entrypoint
|
# Delete a virtual machine entrypoint
|
||||||
public_rm() {
|
public_rm() {
|
||||||
exec rm -vi -- "${bin}/${1}"
|
exec rm -vi -- "launchers/${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Invoke bash as qemu user in its home directory
|
# Invoke bash as qemu user in its home directory
|
||||||
|
@ -154,9 +150,15 @@ public_add() {
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
local name
|
local name
|
||||||
name="${2:-$(basename "$1")}"
|
if [ -n "$2" ]; then
|
||||||
cp -v -i -- "$1" "${bin}/${2}"
|
name="$2"
|
||||||
chmod 740 "${bin}/${name}"
|
else
|
||||||
|
name=$(basename "$1")
|
||||||
|
fi
|
||||||
|
name="${HOME}/launchers/${name}"
|
||||||
|
|
||||||
|
cp -vi -- "$1" "$name"
|
||||||
|
chmod 740 "$name"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
trap - EXIT
|
trap - EXIT
|
||||||
|
|
Loading…
Reference in a new issue