M .local/bin/libs/imv.sh => .local/bin/libs/imv.sh +2 -22
@@ 1,4 1,4 @@
-#!/bin/sh -e
+#!/bin/sh -eu
file="${1}"
@@ 11,26 11,6 @@ else
# ex: "foo.sh" to "/home/samsepi0l/foo.sh"
filepath=$(readlink -f -- "${file}")
- # Grab the resulting directory
- # ex: "/home/samsepi0l/foo.sh" to "/home/samsepi0l"
- filedir=$(dirname -- "${filepath}")
-
- # Prefix paths with "/tmp" on the container
- # ex: "/tmp/home/samsepi0l/foo.sh"
- remote_prefix="/tmp"
- remote_dir="${remote_prefix}${filedir}"
- remote_path="${remote_prefix}${filepath}"
-
- # Create remote directory
- incus exec "${container_name}" -- mkdir -p "${remote_dir}"
-
- # Copy file over
- incus file push -q "${filepath}" "${container_name}${remote_path}"
-
- # Run
- incus exec "${container_name}" -- sh -c "imv ${remote_path}"
-
- # Cleanup
- incus exec "${container_name}" -- sh -c "rm -fr ${remote_dir}"
+ incus exec "${container_name}" -- sh -c "imv -" < "${filepath}"
fi
M .local/bin/libs/pinta.sh => .local/bin/libs/pinta.sh +1 -20
@@ 11,26 11,7 @@ else
# ex: "foo.sh" to "/home/samsepi0l/foo.sh"
filepath=$(readlink -f -- "${file}")
- # Grab the resulting directory
- # ex: "/home/samsepi0l/foo.sh" to "/home/samsepi0l"
- filedir=$(dirname -- "${filepath}")
-
- # Prefix paths with "/tmp" on the container
- # ex: "/tmp/home/samsepi0l/foo.sh"
- remote_prefix="/tmp"
- remote_dir="${remote_prefix}${filedir}"
- remote_path="${remote_prefix}${filepath}"
-
- # Create remote directory
- incus exec "${container_name}" -- mkdir -p "${remote_dir}"
-
- # Copy file over
- incus file push -q "${filepath}" "${container_name}${remote_path}"
-
# Run
- incus exec "${container_name}" -- sh -c "pinta ${remote_path}"
-
- # Cleanup
- incus exec "${container_name}" -- sh -c "rm -fr ${remote_dir}"
+ incus exec "${container_name}" -- sh -c "pinta -" < "${filepath}"
fi
M .local/bin/libs/zathura.sh => .local/bin/libs/zathura.sh +2 -22
@@ 1,4 1,4 @@
-#!/bin/sh -e
+#!/bin/sh -eu
file="${1}"
@@ 11,26 11,6 @@ else
# ex: "foo.sh" to "/home/samsepi0l/foo.sh"
filepath=$(readlink -f -- "${file}")
- # Grab the resulting directory
- # ex: "/home/samsepi0l/foo.sh" to "/home/samsepi0l"
- filedir=$(dirname -- "${filepath}")
-
- # Prefix paths with "/tmp" on the container
- # ex: "/tmp/home/samsepi0l/foo.sh"
- remote_prefix="/tmp"
- remote_dir="${remote_prefix}${filedir}"
- remote_path="${remote_prefix}${filepath}"
-
- # Create remote directory
- incus exec "${container_name}" -- mkdir -p "${remote_dir}"
-
- # Copy file over
- incus file push -q "${filepath}" "${container_name}${remote_path}"
-
- # Run
- incus exec "${container_name}" -- sh -c "zathura ${remote_path}"
-
- # Cleanup
- incus exec "${container_name}" -- sh -c "rm -fr ${remote_dir}"
+ incus exec "${container_name}" -- sh -c "zathura -" < "${filepath}"
fi