diff --git a/podman-ntfy/05_freshinstall.sh b/podman-ntfy/05_freshinstall.sh new file mode 100755 index 0000000..db21d26 --- /dev/null +++ b/podman-ntfy/05_freshinstall.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_pwd_is_scriptdir +ensure_not_root + +if podman volume exists ${ntfy_data_volume}; then + echo "Files or volumes from previous installation already exists" + echo "Please remove them before fresh install, or try continue with normal installation" + exit 1 +fi + +podman volume create ${ntfy_data_volume} +podman unshare chown -R 100:65533 `get_podman_volume_path ${ntfy_data_volume}` +${ABSDIR}/10_install.sh diff --git a/podman-ntfy/10_install.sh b/podman-ntfy/10_install.sh index 5e5456e..b82dffc 100755 --- a/podman-ntfy/10_install.sh +++ b/podman-ntfy/10_install.sh @@ -10,6 +10,11 @@ ensure_not_root ensure_container_not_exists ${container_name} ensure_variables_are_defined "$envvars" +if ! podman volume exists ${ntfy_data_volume} ; then + echo "Error : data volume ${ntfy_data_volume} does not exists. Consider running 05_freshinstall.sh if this is the first install." + exit 1 +fi + if ! podman image exists ${ntfy_image}:${ntfy_version}; then podman image pull ${ntfy_image}:${ntfy_version} || exit 1 fi diff --git a/podman-ntfy/vars.sh b/podman-ntfy/vars.sh index 61bd03a..0c4cd24 100644 --- a/podman-ntfy/vars.sh +++ b/podman-ntfy/vars.sh @@ -11,4 +11,4 @@ envvars='GARBAYE_NTFY_BASE_URL' project_name=${PWD##*/} container_name="${project_name}" service_name="container-${container_name}.service" - +ntfy_data_volume='ntfy-data'