summaryrefslogtreecommitdiffstats
path: root/lib/cmd/opkg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmd/opkg.sh')
-rw-r--r--lib/cmd/opkg.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/cmd/opkg.sh b/lib/cmd/opkg.sh
index cc3c623..795322c 100644
--- a/lib/cmd/opkg.sh
+++ b/lib/cmd/opkg.sh
@@ -22,12 +22,13 @@ use profile
use session
use rand
+cmd_opkg_opks=
+
cmd_opkg_main()
{
local root=
local first_arg=
local install_cmd=
- local opks=
local arg=
local new_fname=
@@ -41,7 +42,7 @@ cmd_opkg_main()
first_arg=true
install_cmd=false
- opks=''
+ cmd_opkg_opks=''
for arg in "${@}"; do
if ${first_arg}; then
set --
@@ -56,7 +57,9 @@ cmd_opkg_main()
fi
rand
new_fname="/tmp/prokit.${rand_x}.opk"
- opks="${opks} ${root}${new_fname}"
+ cmd_opkg_opks="$(printf '%s %s\n' \
+ "${cmd_opkg_opks}" \
+ "${root}${new_fname}")"
cp "${arg}" "${root}${new_fname}"
set -- "${@}" "${new_fname}"
;;
@@ -75,13 +78,18 @@ cmd_opkg_main()
. "${root}/etc/os-release"
profile_set "${ID}"
- session_begin "${root}" . : false
+ session_begin "${root}" . cmd_opkg_fini false
session_exec opkg "${@}"
session_end
- case "${opks}" in
+ cmd_opkg_fini
+}
+
+cmd_opkg_fini()
+{
+ case "${cmd_opkg_opks}" in
*[!\ ]*)
- rm -f ${opks}
+ rm -f ${cmd_opkg_opks}
;;
esac
}