Merge branch 'master' of git.schuerz.at:public/myshellconfig

This commit is contained in:
Jakobus Schürz 2020-12-19 23:22:25 +01:00
commit bdfbef5668
2 changed files with 29 additions and 1 deletions

View file

@ -946,4 +946,32 @@ get_crtime() {
# return 0
#}
is_btrfs_subvolume() {
sudo btrfs subvolume show "$1" >/dev/null
}
convert_to_subvolume () {
local XSUDO
local DIR
case $1 in
--sudo|-s)
XSUDO=sudo
shift
;;
esac
DIR="${1}"
[ -d "${DIR}" ] || return 1
is_btrfs_subvolume "${DIR}" && return 0
set -x
#btrfs subvolume create "${DIR}".new && \
${XSUDO:+sudo} btrfs subvolume create "${DIR}.new" && \
/bin/cp -aTr --reflink=always "${DIR}" "${DIR}".new && \
mv "${DIR}" "${DIR}".orig && \
mv "${DIR}".new "${DIR}" || return 2
set +x
return 0
}
#EOF

@ -1 +1 @@
Subproject commit 474d735b7d68a315e1f426920f9aa7391369b606
Subproject commit 2406c456ee73d32289c2c304ecd8dd1735bc2f2c