Skip to content

Commit f193f8a

Browse files
committed
Workaround missing mktemp and cmp commands
1 parent a57dbe5 commit f193f8a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

templates/update_had_no_effect.sh.epp

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
| -%>
66

77
DIR='var/cache/apt'
8-
EVAL="$(mktemp)"
8+
EVAL="$(mktemp)" || EVAL=/tmp/aptdir
99
apt-config shell DIR Dir::Cache > "$EVAL" && . "$EVAL"
1010
cd "/$DIR" || exit 0
11-
OLD="$(mktemp -p "/$DIR")"
11+
export TMPDIR="/$DIR"
1212
CUR=pkgcache.bin
1313
apt-config shell CUR DIR::Cache::pkgcache >"$EVAL" && . "$EVAL"
14+
OLD="$(mktemp)" || OLD="/${DIR}/${CUR}.old"
1415
rm -f "$EVAL"
1516
ln -f "$CUR" "$OLD"
1617
TRIES=<%= $tries %>
@@ -24,7 +25,7 @@ while true; do
2425
sleep 1
2526
TRIES=$(( TRIES - 1 ))
2627
done
27-
cmp "$CUR" "$OLD"
28-
SAME=$?
28+
SAME=1
29+
cmp "$CUR" "$OLD" && SAME=0
2930
rm -f "$OLD"
3031
exit $SAME

0 commit comments

Comments
 (0)