Install hugo from deb

This commit is contained in:
erik 2024-05-03 11:21:12 +02:00
parent d43cad692a
commit 3524b2209e
3 changed files with 26 additions and 1 deletions

View file

@ -3,6 +3,7 @@ FROM clojure:lein
# Prepare Entrypoint Script # Prepare Entrypoint Script
ADD resources /tmp ADD resources /tmp
ENV HUGO_VERSION="0.125.5"
ENV BUILDDIR="/etc/website" ENV BUILDDIR="/etc/website"
ENV SOURCEDIR="/etc/websitesource" ENV SOURCEDIR="/etc/websitesource"
ENV WEBSITEROOT="/var/www/html/website/" ENV WEBSITEROOT="/var/www/html/website/"

View file

@ -27,3 +27,25 @@ function build-website() {
function move-website-files-to-target() { function move-website-files-to-target() {
(cd $BUILDDIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete target/html/* $WEBSITEROOT;) (cd $BUILDDIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete target/html/* $WEBSITEROOT;)
} }
function install-hugo-from-deb() {
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" -o hugo_extended_${HUGO_VERSION}_linux-amd64.deb
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt" -o checksums.txt
EXPECTED_CHECKSUM="$(sha256sum hugo_extended_${HUGO_VERSION}_linux-amd64.deb)"
ACTUAL_CHECKSUM="$(grep hugo_extended_${HUGO_VERSION}_linux-amd64.deb checksums.txt)"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm hugo.deb
exit 1
fi
echo "Installing hugo"
echo
dpkg -i hugo_extended_${HUGO_VERSION}_linux-amd64.deb
echo "Clean up"
rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
rm checksums.txt
}

View file

@ -6,7 +6,8 @@ function main()
{ {
{ {
upgradeSystem upgradeSystem
apt-get install -qqy unzip rsync jq imagemagick curl hugo apt-get install -qqy unzip rsync jq imagemagick curl
install-hugo-from-deb
install -d /etc/lein/ install -d /etc/lein/
install -m 0700 /tmp/entrypoint.sh / install -m 0700 /tmp/entrypoint.sh /
@ -22,4 +23,5 @@ function main()
} }
source /tmp/install_functions_debian.sh source /tmp/install_functions_debian.sh
source /tmp/functions.sh
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main