diff options
author | Andrew Cady <d@jerkface.net> | 2018-06-12 15:47:18 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2018-06-13 17:13:53 -0400 |
commit | 9978ef7b4a692eb961d396b80a51bd1f9a88cad6 (patch) | |
tree | c9b85c26d6f66edb103bdda20bd83a964b9d0850 | |
parent | 34dbe10ca8ab17dc6c250a5c547bd47584a8105c (diff) |
add "rm" command
-rwxr-xr-x | debootstrap.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/debootstrap.sh b/debootstrap.sh index 2ce7e2c..1b88a86 100755 --- a/debootstrap.sh +++ b/debootstrap.sh | |||
@@ -234,6 +234,18 @@ new() | |||
234 | cp --reflink=always "$source" "$dest" | 234 | cp --reflink=always "$source" "$dest" |
235 | } | 235 | } |
236 | 236 | ||
237 | rm_image() | ||
238 | { | ||
239 | suite=$1 | ||
240 | name=$2 | ||
241 | [ "$suite" -a "$name" ] || usage | ||
242 | image_basename=$imgdir/$(suite_to_basename "$suite") || die 'suite_to_basename' | ||
243 | source=$image_basename | ||
244 | dest=${source%.btrfs}.$name.btrfs | ||
245 | |||
246 | rm -i "$dest" | ||
247 | } | ||
248 | |||
237 | init() | 249 | init() |
238 | { | 250 | { |
239 | suite=$1 | 251 | suite=$1 |
@@ -296,6 +308,6 @@ show() | |||
296 | 308 | ||
297 | case "$1" in | 309 | case "$1" in |
298 | init|new|clone|list|show) cmd=$1; shift; $cmd "$@" ;; | 310 | init|new|clone|list|show) cmd=$1; shift; $cmd "$@" ;; |
299 | chroot|sh) cmd=${1}_image; shift; $cmd "$@" ;; | 311 | chroot|sh|rm) cmd=${1}_image; shift; $cmd "$@" ;; |
300 | *) usage ;; | 312 | *) usage ;; |
301 | esac | 313 | esac |