Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLEAN_ONLY flag #51

Merged
2 commits merged into from Sep 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion snap
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -322,19 +323,22 @@ 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
;;
B)
NO_KBACKUPS=true
;;
C) CLEAN_ONLY=true
;;
c)
CONF_FILE=$OPTARG
;;
Expand Down Expand Up @@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed it before, but there was a missing fi here. Please make sure you run the script after making changes, just to be sure it works!

fi

qbit marked this conversation as resolved.
Show resolved Hide resolved
if [ $KERNEL_ONLY == true ] && [ $SETS_ONLY == true ]; then
echo 'The options -k and -K are mutually exclusive.'
exit 1
Expand Down