diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-08-26 18:18:35 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-08-26 18:18:35 +0200 |
commit | bd3ab6c267978993041a21917ecbb5ea53790e8a (patch) | |
tree | 17f8e5ca1ad6ff9b265905a0ed23d1ec8835d85e /ch | |
parent | 92404da27376766826d6c5117c1e8bdc787bba0f (diff) | |
download | bin-bd3ab6c267978993041a21917ecbb5ea53790e8a.tar.gz bin-bd3ab6c267978993041a21917ecbb5ea53790e8a.tar.xz |
ch: Stop ch kill from initializing a chroot
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'ch')
-rwxr-xr-x | ch | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -37,7 +37,7 @@ __genchroot() { sudo btrfs subvolume snapshot "$chrootdir/root" "$copydir" } -__chrootalias() { +__chrootalias_resolve() { chroot="" chroot_arch="" arg_arch=${1%%+*} @@ -79,6 +79,10 @@ __chrootalias() { chrootdir="$CHROOTS/$chroot" copydir="$chrootdir/$arg_copy" +} + +__chrootalias_resolve_create() { + __chrootalias_resolve "$1" # create chroot if necessary if [[ ! -d "$chrootdir/root" ]]; then @@ -107,7 +111,7 @@ chkill() { return fi - __chrootalias "$1" || return + __chrootalias_resolve "$1" || return for dir in "$CHROOTS/$chroot/"*/; do sudo btrfs subvolume delete "$dir" done @@ -115,20 +119,20 @@ chkill() { } chshell() { - __chrootalias "$1" || return + __chrootalias_resolve_create "$1" || return [ -d "$copydir" ] || __genchroot sudo arch-nspawn "$copydir" "${2:-/bin/bash}" "${@:3}" } chbuild() { - __chrootalias "$1" || return + __chrootalias_resolve_create "$1" || return linux${chroot_arch} sudo makechrootpkg -l "${copydir##*/}" -r "$chrootdir" -n -- -f "${@:2}" chshell "$1" pacman --noconfirm -Rcs namcap __cleanup_logs "$PWD" } chinstall() { - __chrootalias $1 || return; shift + __chrootalias_resolve_create $1 || return; shift for file in "$@"; do files+=(-I "$(readlink -f "$file")") done @@ -137,7 +141,7 @@ chinstall() { } chclean() { - __chrootalias $1 || return + __chrootalias_resolve_create $1 || return for copy in $chrootdir/*/; do if [[ $copy = */root/ ]]; then continue @@ -149,12 +153,12 @@ chclean() { } chrshell() { - __chrootalias $1 || return + __chrootalias_resolve_create $1 || return sudo arch-nspawn "$chrootdir/root" "${2:-/bin/bash}" "${@:3}" } chupdate() { - __chrootalias $1 || return + __chrootalias_resolve_create $1 || return echo ":: Updating $chroot" sudo arch-nspawn "$chrootdir/root" pacman -Syu --noconfirm echo ":: Cleaning up ..." |