agama/setup-web.sh
Martin Vidner cee1b6f5f4 setup-web.sh: run npm-install unconditionally
otherwise npm run fails after the requirements change and we keep working with
an outdated environment: "Cannot find module react-refresh-typescript"
2024-07-18 14:43:52 +02:00

32 lines
578 B
Bash
Executable file

#!/bin/sh -x
# Exit on error; unset variables are an error.
set -eu
MYDIR=$(realpath $(dirname $0))
# Helper:
# Ensure root privileges for the installation.
# In a testing container, we are root but there is no sudo.
if [ $(id --user) != 0 ]; then
SUDO=sudo
if [ $($SUDO id --user) != 0 ]; then
echo "We are not root and cannot sudo, cannot continue."
exit 1
fi
else
SUDO=""
fi
$SUDO zypper --non-interactive install \
'npm>=18'
cd web
npm install
npm run build
cd -
$SUDO mkdir -p /usr/share/agama
$SUDO ln -snf `pwd`/web/dist /usr/share/agama/web_ui