Skip to content

Commit

Permalink
Fix setup script
Browse files Browse the repository at this point in the history
Signed-off-by: Yariv Rachmani <[email protected]>
  • Loading branch information
Yarboa committed May 23, 2024
1 parent d5a4668 commit 1fe6116
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ QM_ROOTFS_TOOL="${INSTALLDIR}/qm-rootfs"
ROOTFS="/usr/lib/qm/rootfs"
RWETCFS="/etc/qm"
RWVARFS="/var/qm"
TMP_QM_IMG_DIR="tmp.images"
AGENT_HOSTNAME="$(hostname)"
AGENTCONF="/etc/bluechi/agent.conf.d/agent.conf"
QM_CONTAINER_IDS=1000000000:1500000000
Expand Down Expand Up @@ -150,8 +149,8 @@ install() {
cmd_dnf_install="dnf -y install --releasever=${VERSION_ID} --installroot ${ROOTFS} ${PACKAGES_TO_INSTALL}"
${cmd_dnf_install}

if dnf --installroot "${ROOTFS}" list installed "${PACKAGE_TO_REMOVE}" > /dev/null 2>&1; then
dnf --installroot ${ROOTFS} remove ${PACKAGES_TO_REMOVE} -y
if dnf --installroot "${ROOTFS}" list installed "${PACKAGES_TO_REMOVE}" > /dev/null 2>&1; then
dnf --installroot "${ROOTFS}" remove "${PACKAGES_TO_REMOVE}" -y
fi

# check if "${ROOTFS}"/etc/yum.repos.d
Expand Down Expand Up @@ -186,6 +185,7 @@ EOF
/etc/systemd/system/multi-user.target.wants/bluechi-agent.service
fi

bash -x "${INSTALLDIR}/qm-storage-settings"
restorecon -R "${ROOTFS}"
umount "${ROOTFS}/var" "${ROOTFS}/etc"
}
Expand Down
15 changes: 8 additions & 7 deletions tools/qm-storage-settings
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

# Global vars
TMP_QM_IMG_DIR="tmp.images"
QM_ROOTFS_TOOL="/usr/share/qm/qm-rootfs"
STORAGE_CONFIG=""

# exec_command will try to find the command before execute, it will try first in a regular
Expand All @@ -28,7 +27,7 @@ exec_command() {
COMMAND="/run/osbuild/tree$1"
if [ -f "${COMMAND}" ]; then
# FIXME: support this in qm-rootfs and remove this if condition
# it's a deploy/install moment in ostree
# it's a deploy/install moment in ostree
echo "/run/osbuild/tree/usr/lib/qm/rootfs"
return
else
Expand All @@ -38,18 +37,20 @@ exec_command() {
fi

# print the output of QM ROOTFS
echo $($COMMAND)
echo "$COMMAND"
}

setup_init() {
ROOTFS=$(exec_command "/usr/share/qm/qm-rootfs")

# containers/storage.conf
STORAGE_CONFIG="${ROOTFS}/etc/containers/storage.conf"
if [ ! -f "${STORAGE_CONFIG}" ]; then # no path, let's try ostree approach
if [ ! -d /run/osbiuild/ostree ]; then # osbuild exist, let's try ostree approach
cp -p "${ROOTFS}"/usr/share/containers/storage.conf "${ROOTFS}"/etc/containers/storage.conf
else
STORAGE_CONFIG="/run/osbuild/tree/${STORAGE_CONFIG}"
if [ ! -f "${STORAGE_CONFIG}" ]; then
echo "Exiting /etc/containers/storage.conf in the ROOTFS"
echo "Exiting /etc/containers/storage.conf in the ROOTFS"
exit 255
fi
fi
Expand All @@ -59,7 +60,7 @@ additional_images_storages() {
if ! grep -q "/var/lib/shared" "${STORAGE_CONFIG}"; then
awk -i inplace '
BEGIN {
# Initialize insideBlock to 0 to track when we are inside the 'additionalimagestores' block
# Initialize insideBlock to 0 to track when we are inside the "additionalimagestores" block
insideBlock = 0
}
Expand Down Expand Up @@ -146,4 +147,4 @@ EOF
# main
setup_init
update_storage_conf
exit 0
exit 0

0 comments on commit 1fe6116

Please sign in to comment.