Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ echo "Starting provisioning script"
echo "Making configuration immutable"
$BUSYBOX chattr +i /etc/resolv.conf

# Helper function to check if a package is installed
is_package_installed() {
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "install ok installed"
}

# Install required packages if not already installed
PACKAGES="systemd systemd-sysv openssh-server sudo chrony linuxptp socat curl ca-certificates"
PACKAGES="systemd systemd-sysv openssh-server sudo chrony linuxptp socat curl ca-certificates fuse3"
echo "Checking presence of the following packages: $PACKAGES"

MISSING=""

for pkg in $PACKAGES; do
if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then
if ! is_package_installed "$pkg"; then
echo "Package $pkg is missing, will install it."
MISSING="$MISSING $pkg"
fi
Expand All @@ -30,6 +34,20 @@ else
echo "All required packages are already installed."
fi

# Install mount-s3 separately from URL if not already installed
MOUNTPOINT_ARCH="x86_64"
MOUNTPOINT_URL="https://s3.amazonaws.com/mountpoint-s3-release/latest/$MOUNTPOINT_ARCH/mount-s3.deb"
MOUNTPOINT_DOWNLOAD_PATH="/tmp/mount-s3.deb"

if ! is_package_installed "mount-s3"; then
echo "mount-s3 is missing, installing from URL"
curl -fsSL "$MOUNTPOINT_URL" -o "$MOUNTPOINT_DOWNLOAD_PATH"
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes apt-get -qq -o=Dpkg::Use-Pty=0 install -y --no-install-recommends "$MOUNTPOINT_DOWNLOAD_PATH"
rm -f "$MOUNTPOINT_DOWNLOAD_PATH"
else
echo "mount-s3 is already installed."
fi

echo "Setting up shell"
echo "export SHELL='/bin/bash'" >/etc/profile.d/shell.sh
echo "export PS1='\w \$ '" >/etc/profile.d/prompt.sh
Expand Down
Loading