M .local/bin/libs/pinta.sh => .local/bin/libs/pinta.sh +20 -1
@@ 11,7 11,26 @@ 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 -" < "${filepath}"
+ incus exec "${container_name}" -- sh -c "pinta ${remote_path}"
+
+ # Cleanup
+ incus exec "${container_name}" -- sh -c "rm -fr ${remote_dir}"
fi