Skip to content

Commit

Permalink
Avoid cache/RELEASE dirs creation on Linux jails
Browse files Browse the repository at this point in the history
Don't create unused/stale cache/RELEASE directory/datasets on Linux jails creation.
  • Loading branch information
JRGTH committed May 15, 2022
1 parent 3ba1024 commit 62d0380
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions usr/local/share/bastille/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,29 @@ bootstrap_directories() {
if [ "${bastille_zfs_enable}" = "YES" ]; then
if [ -n "${bastille_zfs_zpool}" ]; then
zfs create ${bastille_zfs_options} -o mountpoint="${bastille_cachedir}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache"
zfs create ${bastille_zfs_options} -o mountpoint="${bastille_cachedir}/${RELEASE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${RELEASE}"
# Don't create unused/stale cache/RELEASE directory on Linux jails creation.
if [ -z "${NOCACHEDIR}" ]; then
zfs create ${bastille_zfs_options} -o mountpoint="${bastille_cachedir}/${RELEASE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${RELEASE}"
fi
fi
else
mkdir -p "${bastille_cachedir}/${RELEASE}"
mkdir -p "${bastille_cachedir}"
# Don't create unused/stale cache/RELEASE directory on Linux jails creation.
if [ -z "${NOCACHEDIR}" ]; then
mkdir -p "${bastille_cachedir}/${RELEASE}"
fi
fi
## create subsequent cache/XX.X-RELEASE datasets
elif [ ! -d "${bastille_cachedir}/${RELEASE}" ]; then
if [ "${bastille_zfs_enable}" = "YES" ]; then
if [ -n "${bastille_zfs_zpool}" ]; then
zfs create ${bastille_zfs_options} -o mountpoint="${bastille_cachedir}/${RELEASE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${RELEASE}"
# Don't create unused/stale cache/RELEASE directory on Linux jails creation.
if [ -z "${NOCACHEDIR}" ]; then
if [ "${bastille_zfs_enable}" = "YES" ]; then
if [ -n "${bastille_zfs_zpool}" ]; then
zfs create ${bastille_zfs_options} -o mountpoint="${bastille_cachedir}/${RELEASE}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${RELEASE}"
fi
else
mkdir -p "${bastille_cachedir}/${RELEASE}"
fi
else
mkdir -p "${bastille_cachedir}/${RELEASE}"
fi
fi

Expand Down Expand Up @@ -305,6 +315,7 @@ bootstrap_release() {
debootstrap_release() {

# Make sure to check/bootstrap directories first.
NOCACHEDIR=1
RELEASE="${DIR_BOOTSTRAP}"
bootstrap_directories

Expand Down Expand Up @@ -445,6 +456,7 @@ else
HW_MACHINE_ARCH_LINUX=${HW_MACHINE_ARCH}
fi

NOCACHEDIR=
RELEASE="${1}"
OPTION="${2}"

Expand Down

0 comments on commit 62d0380

Please sign in to comment.