diff --git a/snap b/snap index 07935cc..db50f59 100755 --- a/snap +++ b/snap @@ -30,6 +30,7 @@ snap options: -s force snap to use snapshots. -S do not check signatures. + -C only remove partial downloads. -c specify location of config file (default is ~/.snaprc) -e just extract sets in DST. -d just download sets to DST, verify and exit. @@ -322,12 +323,13 @@ REBOOT=$(get_conf_var 'REBOOT' || echo 'false') AFTER=$(get_conf_var 'AFTER' || echo 'false') DOWNLOAD_ONLY=false WEXIT=$(get_conf_var 'WEXIT' || echo 'false') +CLEAN_ONLY=false MIRROR=$(get_conf_var 'MIRROR' || \ awk -F/ 'match($3, /[a-z]/) {print $3}' /etc/installurl 2> /dev/null || \ echo "cdn.openbsd.org") -while getopts "b:Bc:dD:ehiIkKm:M:nrRsSuUV:Wx" arg; do +while getopts "b:BCc:dD:ehiIkKm:M:nrRsSuUV:Wx" arg; do case $arg in b) INSTBOOT=$OPTARG @@ -335,6 +337,8 @@ while getopts "b:Bc:dD:ehiIkKm:M:nrRsSuUV:Wx" arg; do B) NO_KBACKUPS=true ;; + C) CLEAN_ONLY=true + ;; c) CONF_FILE=$OPTARG ;; @@ -408,6 +412,14 @@ while getopts "b:Bc:dD:ehiIkKm:M:nrRsSuUV:Wx" arg; do esac done +if [ $CLEAN_ONLY == true ]; then + if [ $DST ]; then + rm -rf $DST/snap.* + else + rm -rf /tmp/snap.* + exit 0 +fi + if [ $KERNEL_ONLY == true ] && [ $SETS_ONLY == true ]; then echo 'The options -k and -K are mutually exclusive.' exit 1