Skip to content

Commit c8f51c5

Browse files
committed
snapshot: make it callable from another command
1 parent 7bb8df3 commit c8f51c5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

share/pot/snapshot.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pot-snapshot()
2727
case "$_o" in
2828
h)
2929
snapshot-help
30-
${EXIT} 0
30+
return 0
3131
;;
3232
v)
3333
_POT_VERBOSITY=$(( _POT_VERBOSITY + 1))
@@ -48,7 +48,7 @@ pot-snapshot()
4848
else
4949
_error "-p|-f are exclusive"
5050
snapshot-help
51-
${EXIT} 1
51+
return 1
5252
fi
5353
;;
5454
f)
@@ -58,7 +58,7 @@ pot-snapshot()
5858
else
5959
_error "-p|-f are exclusive"
6060
snapshot-help
61-
${EXIT} 1
61+
return 1
6262
fi
6363
;;
6464
n)
@@ -69,37 +69,37 @@ pot-snapshot()
6969
;;
7070
*)
7171
snapshot-help
72-
${EXIT} 1
72+
return 1
7373
;;
7474
esac
7575
done
7676
if [ -z "$_obj" ]; then
7777
_error "one of -p|-f has to be used"
7878
snapshot-help
79-
$EXIT 1
79+
return 1
8080
fi
8181
if [ -z "$_objname" ]; then
8282
_error "-p|-f options need an argument"
8383
snapshot-help
84-
${EXIT} 1
84+
return 1
8585
fi
8686
case $_obj in
8787
"pot")
8888
if [ -n "$_snapname" ]; then
8989
_error "Option -n usable only with fscomp"
90-
${EXIT} 1
90+
return 1
9191
fi
9292
if ! _is_pot "$_objname" ; then
9393
_error "$_objname is not a pot!"
9494
snapshot-help
95-
${EXIT} 1
95+
return 1
9696
fi
9797
if _is_pot_running "$_objname" ; then
9898
_error "The pot $_objname is still running. Snapshot is possible only for stopped pots"
99-
${EXIT} 1
99+
return 1
100100
fi
101101
if ! _is_uid0 ; then
102-
${EXIT} 1
102+
return 1
103103
fi
104104

105105
if [ "$_full_pot" = "YES" ]; then
@@ -115,13 +115,13 @@ pot-snapshot()
115115
if ! _zfs_exist "${POT_ZFS_ROOT}/fscomp/$_objname" "${POT_FS_ROOT}/fscomp/$_objname" ; then
116116
_error "$_objname is not a valid fscomp"
117117
snapshot-help
118-
${EXIT} 1
118+
return 1
119119
fi
120120
if [ "$_full_pot" = "YES" ]; then
121121
_info "-a option is incompatible with -f. Ignored"
122122
fi
123123
if ! _is_uid0 ; then
124-
${EXIT} 1
124+
return 1
125125
fi
126126
if [ "$_replace" = "YES" ]; then
127127
_remove_oldest_fscomp_snap "$_objname"

0 commit comments

Comments
 (0)