chiark
/
gitweb
/
~ianmdlvl
/
dsa-metapackages.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dgit now uses just curl, not wget
[dsa-metapackages.git]
/
apt-in-chroot
diff --git
a/apt-in-chroot
b/apt-in-chroot
index 0fd9db87da2b9e94c421817e844ad121aa4d110f..7126202770fc3cda2771196e4708aa57a31cb4c6 100755
(executable)
--- a/
apt-in-chroot
+++ b/
apt-in-chroot
@@
-20,7
+20,7
@@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
-PATH="/usr/bin:/bin"
+PATH="/usr/
sbin:/usr/bin:/s
bin:/bin"
export PATH
usage() {
export PATH
usage() {
@@
-33,6
+33,9
@@
usage() {
echo " + purge"
echo " + build-dep"
echo " + update"
echo " + purge"
echo " + build-dep"
echo " + update"
+ echo " + upgrade"
+ echo " + dist-upgrade"
+ echo " + clean"
}
}
@@
-53,12
+56,14
@@
if [ -x /usr/bin/dchroot ] ; then
chroots=$(dchroot -l 2>&1 | awk -F": " '{print $2}' | tr ' ' '\n')
method=dchroot
suffix[${#suffix[*]}]="_$(dpkg --print-architecture)"
chroots=$(dchroot -l 2>&1 | awk -F": " '{print $2}' | tr ' ' '\n')
method=dchroot
suffix[${#suffix[*]}]="_$(dpkg --print-architecture)"
+ allowed_filter='.'
elif [ -x /usr/bin/schroot ] ; then
chroots=$(schroot -l | awk -F":" '{print $2}' | grep -- '-dchroot$' )
method=schroot
elif [ -x /usr/bin/schroot ] ; then
chroots=$(schroot -l | awk -F":" '{print $2}' | grep -- '-dchroot$' )
method=schroot
- suffix
="-dchroot
"
+ suffix
[${#suffix[*]}]="
"
suffix[${#suffix[*]}]="-dchroot"
suffix[${#suffix[*]}]="-$(dpkg --print-architecture)-dchroot"
suffix[${#suffix[*]}]="-dchroot"
suffix[${#suffix[*]}]="-$(dpkg --print-architecture)-dchroot"
+ allowed_filter='-dchroot$'
else
echo >&2 "Cannot find chroot wrapper."
exit 1
else
echo >&2 "Cannot find chroot wrapper."
exit 1
@@
-77,10
+82,14
@@
if ! [ -n "$requested_chroot" ]; then
echo >&2 "$CHROOT is not a valid dchroot. Available chroots are:"
echo "$chroots"
exit 1
echo >&2 "$CHROOT is not a valid dchroot. Available chroots are:"
echo "$chroots"
exit 1
+elif ! [[ "$requested_chroot" =~ $allowed_filter ]]; then # do not quote the regex
+ echo >&2 "$CHROOT is not a valid dchroot. While it exists, this script may not touch it. Chroot names must match $allowed_filter."
+ exit 1
fi
fi
+
case "$APTCMD" in
case "$APTCMD" in
-install|remove|purge|build-dep|update)
+install|remove|purge|build-dep|update
|upgrade|dist-upgrade|clean
)
# those are the allowed apt sub-commands
;;
*)
# those are the allowed apt sub-commands
;;
*)