From 6b8b1a1985d5853e185f64141208aa670ff8e3a7 Mon Sep 17 00:00:00 2001 From: Mario Flach Date: Mon, 9 Oct 2017 14:32:30 +0200 Subject: [PATCH 1/2] Point iocroot to /usr/local/iocell --- lib/ioc-globals | 2 +- lib/ioc-zfs | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/ioc-globals b/lib/ioc-globals index fabd344..cc197c2 100644 --- a/lib/ioc-globals +++ b/lib/ioc-globals @@ -102,7 +102,7 @@ wallclock="off" # Custom properties pool="none" -iocroot=/iocell +iocroot="usr/local/iocell" tag=$(date "+%F@%T") istemplate="no" bpf="off" diff --git a/lib/ioc-zfs b/lib/ioc-zfs index 7894dda..c0f2852 100644 --- a/lib/ioc-zfs +++ b/lib/ioc-zfs @@ -16,7 +16,7 @@ __activate () { # active pools. for _fs in ${_filesystems} ; do if [ "${_fs}" = "iocell" ] ; then - zfs set mountpoint="/${_fs}" "${pool}/${_fs}" > /dev/null 2>&1 + zfs set mountpoint="/usr/local/${_fs}" "${pool}/${_fs}" > /dev/null 2>&1 else zfs inherit -r mountpoint "${pool}/${_fs}" > /dev/null 2>&1 fi @@ -951,23 +951,23 @@ __check_filesystems () { zfs create -p "${pool}/${_fs}" if [ "${_fs}" = "iocell" ] ; then - zfs set mountpoint="/${_fs}" "${pool}/${_fs}" \ + zfs set mountpoint="/usr/local/${_fs}" "${pool}/${_fs}" \ > /dev/null 2>&1 fi - if [ "${_altroot}" != "-" -a ! -d "/iocell" ] ; then + if [ "${_altroot}" != "-" -a ! -d "/usr/local/iocell" ] ; then sed -i '' s#.*iocroot.*#iocroot="${_altroot}/iocell"# \ "${LIB}/ioc-globals" export iocroot="${_altroot}/iocell" - elif [ "${_altroot}" = "/mnt" -a -d "/iocell" ] ; then + elif [ "${_altroot}" = "/mnt" -a -d "/usr/local/iocell" ] ; then # we're in a chroot. - sed -i '' s#.*iocroot.*#iocroot="/iocell"# \ + sed -i '' s#.*iocroot.*#iocroot="/usr/local/iocell"# \ "${LIB}/ioc-globals" export iocroot="${_altroot}/iocell" elif [ "${_altroot}" = "-" ] ; then - sed -i '' s#.*iocroot.*#iocroot="/iocell"# \ + sed -i '' s#.*iocroot.*#iocroot="/usr/local/iocell"# \ "${LIB}/ioc-globals" - export iocroot="/iocell" + export iocroot="/usr/local/iocell" fi fi fi @@ -985,7 +985,7 @@ __check_filesystems () { # Checks to see if the user changed the altroot and modify ioc-globals # If the user decided to unset their altroot, they need to run again as # root to set it back to the default location - if [ "${_altroot}" != "-" ] && [ "$(id -un)" = "root" ] && [ ! -d "/iocell" ] ; then + if [ "${_altroot}" != "-" ] && [ "$(id -un)" = "root" ] && [ ! -d "/usr/local/iocell" ] ; then sed -i '' s#.*iocroot.*#iocroot="${_altroot}/iocell"# \ "${LIB}/ioc-globals" export iocroot="${_altroot}/iocell" @@ -995,11 +995,11 @@ __check_filesystems () { echo " Please run as root to fix." >&2 exit 1 elif [ "${_altroot}" = "-" ] && [ "$(id -un)" = "root" ] ; then - sed -i '' s#.*iocroot.*#iocroot="/iocell"# \ + sed -i '' s#.*iocroot.*#iocroot="/usr/local/iocell"# \ "${LIB}/ioc-globals" - export iocroot="/iocell" + export iocroot="/usr/local/iocell" elif [ "${_altroot}" = "-" ] && [ "$(id -un)" != "root" ] && \ - [ "${iocroot}" != "/iocell" ] ; then + [ "${iocroot}" != "/usr/local/iocell" ] ; then __error "You changed the altroot of ${pool}" echo " Please run as root to fix." >&2 exit 1 From c3b586c642975ee6d21b1137775ef39f58d90dc0 Mon Sep 17 00:00:00 2001 From: Mario Flach Date: Mon, 9 Oct 2017 23:06:10 +0200 Subject: [PATCH 2/2] Fix broken ${iocroot} path in different libs --- lib/ioc-common | 2 +- lib/ioc-configure | 2 +- lib/ioc-git | 4 ++-- lib/ioc-hacks | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ioc-common b/lib/ioc-common index 156c74d..d3bdfb1 100644 --- a/lib/ioc-common +++ b/lib/ioc-common @@ -515,7 +515,7 @@ __cleanup_release_dir () { if [ -n "${_dwn_rel_exist}" ] ; then _dwn_dir_exist=$(zfs get -H -o value mountpoint \ ${pool}/iocell/download/${_rel_name}) - zfs destroy -fr -- ${pool}${iocroot}/download/${_rel_name} + zfs destroy -fr -- ${pool}/iocell/download/${_rel_name} if [ -d "${_dwn_dir_exist}" ]; then rm -rf -- ${_dwn_dir_exist} fi diff --git a/lib/ioc-configure b/lib/ioc-configure index 40618c0..d6b2b0d 100644 --- a/lib/ioc-configure +++ b/lib/ioc-configure @@ -102,7 +102,7 @@ __configure_jail () { fi if [ -z "${_dataset}" ] ; then - _dataset="${pool}${_mountpoint}" + _dataset="${pool}/iocell/jails/${_fulluuid}" fi __ucl_set "${_mountpoint}" "${_prop_name}" "${_value}" "1" diff --git a/lib/ioc-git b/lib/ioc-git index 6c05678..3c85a78 100644 --- a/lib/ioc-git +++ b/lib/ioc-git @@ -51,7 +51,7 @@ __fetch_plugin () { # does not exist yet. if [ -d "${iocroot}/releases/${_release}" ] ; then if [ -z "$(ls -A ${iocroot}/releases/${_release}/root)" ] ; then - zfs destroy "${iocroot}/releases/${_release}" + zfs destroy "${pool}/iocell/releases/${_release}" fi fi @@ -134,7 +134,7 @@ __fetch_plugin () { if [ "${_branch_rel}" != "${_release}" ] ; then if [ -d "${iocroot}/releases/${_branch_rel}" ] ; then if [ -z "$(ls -A ${iocroot}/releases/${_branch_rel}/root)" ] ; then - zfs destroy "${iocroot}/releases/${_branch_rel}" + zfs destroy "${pool}/iocell/releases/${_branch_rel}" fi fi diff --git a/lib/ioc-hacks b/lib/ioc-hacks index 61e2ed8..37d81c6 100644 --- a/lib/ioc-hacks +++ b/lib/ioc-hacks @@ -23,7 +23,7 @@ __hack88_mount () { if [ "${_hack88}" = "1" ] && [ "${_mount_len}" -eq "37" ] && [ "${_template}" = "no" ]; then __unlink_tag $_dataset echo " INFO: truncating jail mountpoint" - zfs umount -f "${iocroot}/jails/${_fulluuid}" + zfs umount -f "${pool}/iocell/jails/${_fulluuid}" zfs set mountpoint="${iocroot}/jails/${_shortuuid}" "${_dataset}" zfs list -rH -o name "${pool}/iocell/jails/${_fulluuid}" | \ egrep -v "${_jail_zfs_dataset_re}" | xargs -L 1 zfs mount @@ -36,7 +36,7 @@ __hack88_mount () { elif [ "${_hack88}" != "1" ] && [ "${_mount_len}" -lt "37" ] && [ "${_template}" = "no" ] ; then __unlink_tag "${_dataset}" echo " INFO: restoring jail mountpoint" - zfs umount -f "${iocroot}/jails/${_shortuuid}" + zfs umount -f "${pool}/iocell/jails/${_shortuuid}" zfs set mountpoint="${iocroot}/jails/${_fulluuid}" "${_dataset}" zfs list -rH -o name "${pool}/iocell/jails/${_fulluuid}" | \ egrep -v "${_jail_zfs_dataset_re}" | xargs -L 1 zfs mount