diff options
Diffstat (limited to 'src/fripost-partman-udeb/base.sh')
-rw-r--r-- | src/fripost-partman-udeb/base.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fripost-partman-udeb/base.sh b/src/fripost-partman-udeb/base.sh index b6770f8..976cfb6 100644 --- a/src/fripost-partman-udeb/base.sh +++ b/src/fripost-partman-udeb/base.sh @@ -586,3 +586,19 @@ getIPv4() { $ip -4 address show dev "$if" scope global \ | sed -nr '/^\s+inet\s([[:xdigit:].:]{3,39}).*/ {s//\1/p;q}' } + + + +############################################################################## +# Remove a partition from a device +# +# Usage: fripost_rmpart device partition + +fripost_rmpart () { + local device="$1" part="$2" + n=$( /sbin/parted -sm "$device" p + | sed -nr "/^[0-9].*:$part:[^:]*;$/ s/:.*//p" ) + [ "$n" ] || return + log "Removing partition $n ($part) from $device" + /sbin/parted -sm "$device" rm "$n" +} |