19 lines
368 B
Bash
19 lines
368 B
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
user="${1}"
|
|
base_dir="/var/lib/machines"
|
|
base_subvol="bip.f28.ro"
|
|
|
|
if [ -z "${user}" ] ; then
|
|
echo Please provide the username to delete
|
|
exit 1
|
|
fi
|
|
|
|
new_subvol="$(echo ${base_subvol} | cut -d . -f 1)"."${user}"
|
|
userdel -r "${user}"
|
|
machinectl poweroff "${new_subvol}"
|
|
machinectl disable "${new_subvol}"
|
|
btrfs sub d "${base_dir}"/"${new_subvol}"
|
|
|