2021-05-26 20:15:55 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-01-28 13:26:42 +00:00
|
|
|
|
|
|
|
ABSDIR="$( dirname "$(readlink -f -- "$0")" )"
|
|
|
|
source ${ABSDIR}/../functions.sh
|
|
|
|
source ${ABSDIR}/vars.sh
|
|
|
|
|
|
|
|
ensure_pwd_is_scriptdir
|
|
|
|
ensure_not_root
|
|
|
|
|
2022-02-13 21:49:28 +00:00
|
|
|
if ! podman volume exists ${srvdata_volume} ; then
|
|
|
|
echo "Error : data volume ${srvdata_volume} does not exists. Consider running 05_freshinstall.sh if this is the first install."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-11-13 13:10:30 +00:00
|
|
|
if ! podman image exists "${privatebin_image}":"${privatebin_version}"; then
|
|
|
|
podman image pull "${privatebin_image}":"${privatebin_version}" || exit 1
|
|
|
|
fi
|
2024-12-21 21:50:08 +00:00
|
|
|
|
|
|
|
sha=$(skopeo inspect docker://"${privatebin_image}":"${privatebin_version}" | jq -r '.Labels."org.opencontainers.image.revision"')
|
|
|
|
curl -so ${HOME}/conf.php https://raw.githubusercontent.com/PrivateBin/PrivateBin/${sha}/cfg/conf.sample.php
|
|
|
|
# disable never expire option
|
|
|
|
sed_in_place "never = 0" ";never = 0" ${HOME}/conf.php
|
|
|
|
|
2023-12-05 15:48:36 +00:00
|
|
|
podman container run -d --read-only --name ${container_name} \
|
2022-02-13 21:49:28 +00:00
|
|
|
-p ${listen_if}:${listen_port}:8080 \
|
2024-11-22 17:41:20 +00:00
|
|
|
--mount=type=tmpfs,destination=/run,U=true \
|
|
|
|
--mount=type=tmpfs,destination=/tmp \
|
|
|
|
--mount=type=tmpfs,destination=/var/lib/nginx/tmp,U=true \
|
2024-11-22 17:44:00 +00:00
|
|
|
-v ${srvdata_volume}:/srv/data:U,Z \
|
2024-12-21 21:50:08 +00:00
|
|
|
-v ${HOME}/conf.php:/srv/cfg/conf.php:U,Z,ro \
|
2022-08-15 08:31:39 +00:00
|
|
|
"${privatebin_image}":"${privatebin_version}" &&
|
2023-04-21 11:53:55 +00:00
|
|
|
( podman container logs -f ${container_name} 2>&1 & ) | grep -q 'NOTICE: ready to handle connections' &&
|
|
|
|
podman container stop ${container_name} &&
|
2022-02-14 06:43:58 +00:00
|
|
|
echo Container ${container_name} successfully built and stopped.
|