|
@@ -25,10 +25,15 @@ function usage()
|
|
Usage: $program [options]
|
|
Usage: $program [options]
|
|
|
|
|
|
Options:
|
|
Options:
|
|
- -e, --execute clean up the apt-p2p cache
|
|
|
|
- -h, --help show this help message and exit
|
|
|
|
- -n, --no-execute show what would be done to clean up the apt-p2p cache
|
|
|
|
- -v, --version show version information and exit
|
|
|
|
|
|
+ -a ARCHIVE, --archive=ARCHIVE set the APT archive directory (default:
|
|
|
|
+ $_apt_archive)
|
|
|
|
+ -c CACHE, --cache=CACHE set the Apt-P2P cache directory (default:
|
|
|
|
+ $_apt_p2p_cache)
|
|
|
|
+ -e, --execute clean up the Apt-P2P cache
|
|
|
|
+ -h, --help show this help message and exit
|
|
|
|
+ -n, --no-execute show what would be done to clean up the
|
|
|
|
+ Apt-P2P cache
|
|
|
|
+ -v, --version show version information and exit
|
|
EOF
|
|
EOF
|
|
exit $@
|
|
exit $@
|
|
}
|
|
}
|
|
@@ -40,19 +45,31 @@ function version()
|
|
}
|
|
}
|
|
|
|
|
|
program=`basename $0`
|
|
program=`basename $0`
|
|
-version='1.0'
|
|
|
|
|
|
+version='1.0.1'
|
|
apt_p2p_cache='/var/cache/apt-p2p/cache'
|
|
apt_p2p_cache='/var/cache/apt-p2p/cache'
|
|
|
|
+_apt_p2p_cache="$apt_p2p_cache"
|
|
apt_archive='/var/cache/apt/archives'
|
|
apt_archive='/var/cache/apt/archives'
|
|
-args=`getopt -l 'execute,help,no-execute,version' -n "$program" -o 'ehnv' -- "$@"`
|
|
|
|
-val=$?
|
|
|
|
|
|
+_apt_archive="$apt_archive"
|
|
|
|
+args=`getopt -l 'archive:,cache:,execute,help,no-execute,version' -n "$program" -o 'a:c:ehnv' -- "$@"`
|
|
|
|
+value=$?
|
|
|
|
|
|
-[[ $val != 0 ]] && usage $val
|
|
|
|
|
|
+[[ $value != 0 ]] && usage $value
|
|
|
|
|
|
eval set -- "$args"
|
|
eval set -- "$args"
|
|
-unset args val
|
|
|
|
|
|
+unset args
|
|
|
|
|
|
until [[ "$1" == -- ]]; do
|
|
until [[ "$1" == -- ]]; do
|
|
|
|
+ value=1
|
|
|
|
+
|
|
case "$1" in
|
|
case "$1" in
|
|
|
|
+ (-a|--archive)
|
|
|
|
+ apt_archive="$2"
|
|
|
|
+ value=2
|
|
|
|
+ ;;
|
|
|
|
+ (-c|--cache)
|
|
|
|
+ apt_p2p_cache="$2"
|
|
|
|
+ value=2
|
|
|
|
+ ;;
|
|
(-e|--execute)
|
|
(-e|--execute)
|
|
execute=1
|
|
execute=1
|
|
;;
|
|
;;
|
|
@@ -67,11 +84,12 @@ until [[ "$1" == -- ]]; do
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
|
|
|
|
- shift
|
|
|
|
|
|
+ shift $value
|
|
done
|
|
done
|
|
|
|
|
|
[[ -z $execute ]] && usage
|
|
[[ -z $execute ]] && usage
|
|
|
|
|
|
|
|
+unset value
|
|
set -e
|
|
set -e
|
|
|
|
|
|
for directory in "$apt_p2p_cache" "$apt_archive"; do
|
|
for directory in "$apt_p2p_cache" "$apt_archive"; do
|