Updated spn-hub to remove teh portmaster-start dependency.
This commit is contained in:
@@ -3,18 +3,18 @@ FROM alpine as builder
|
|||||||
# Ensure ca-certficates are up to date
|
# Ensure ca-certficates are up to date
|
||||||
# RUN update-ca-certificates
|
# RUN update-ca-certificates
|
||||||
|
|
||||||
# Download and verify portmaster-start binary.
|
# Download and verify spn-hub binary.
|
||||||
RUN mkdir /init
|
RUN mkdir /init
|
||||||
RUN wget https://updates.safing.io/linux_amd64/start/portmaster-start_v0-9-6 -O /init/portmaster-start
|
RUN wget https://updates.safing.io/latest/linux_amd64/hub/spn-hub -O /init/spn-hub
|
||||||
COPY start-checksum.txt /init/start-checksum
|
COPY start-checksum.txt /init/start-checksum
|
||||||
RUN cd /init && sha256sum -c /init/start-checksum
|
RUN cd /init && sha256sum -c /init/start-checksum
|
||||||
RUN chmod 555 /init/portmaster-start
|
RUN chmod 555 /init/spn-hub
|
||||||
|
|
||||||
# Use minimal image as base.
|
# Use minimal image as base.
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
# Copy the static executable.
|
# Copy the static executable.
|
||||||
COPY --from=builder /init/portmaster-start /init/portmaster-start
|
COPY --from=builder /init/spn-hub /init/spn-hub
|
||||||
|
|
||||||
# Copy the init script
|
# Copy the init script
|
||||||
COPY container-init.sh /init.sh
|
COPY container-init.sh /init.sh
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
DATA="/data"
|
DATA="/data"
|
||||||
START="/data/portmaster-start"
|
START="/data/spn-hub"
|
||||||
INIT_START="/init/portmaster-start"
|
INIT_START="/init/spn-hub"
|
||||||
|
|
||||||
# Set safe shell options.
|
# Set safe shell options.
|
||||||
set -euf -o pipefail
|
set -euf -o pipefail
|
||||||
@@ -18,13 +18,10 @@ if [ ! -f $START ]; then
|
|||||||
cp $INIT_START $START
|
cp $INIT_START $START
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download updates.
|
|
||||||
echo "running: $START update --data /data --intel-only"
|
|
||||||
$START update --data /data --intel-only
|
|
||||||
|
|
||||||
# Remove PID file, which could have been left after a crash.
|
# Remove PID file, which could have been left after a crash.
|
||||||
rm -f $DATA/hub-lock.pid
|
rm -f $DATA/hub-lock.pid
|
||||||
|
|
||||||
# Always start the SPN Hub with the updated main start binary.
|
# Always start the SPN Hub with the updated main start binary.
|
||||||
echo "running: $START hub --data /data -- $@"
|
echo "running: $START"
|
||||||
$START hub --data /data -- $@
|
$START -- $@
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ set -e
|
|||||||
|
|
||||||
ARCH=
|
ARCH=
|
||||||
INSTALLDIR=
|
INSTALLDIR=
|
||||||
PMSTART=
|
SPNBINARY=
|
||||||
ENABLENOW=
|
ENABLENOW=
|
||||||
INSTALLSYSTEMD=
|
INSTALLSYSTEMD=
|
||||||
SYSTEMDINSTALLPATH=
|
SYSTEMDINSTALLPATH=
|
||||||
@@ -22,7 +22,7 @@ SYSTEMDINSTALLPATH=
|
|||||||
apply_defaults() {
|
apply_defaults() {
|
||||||
ARCH=${ARCH:-amd64}
|
ARCH=${ARCH:-amd64}
|
||||||
INSTALLDIR=${INSTALLDIR:-/opt/safing/spn}
|
INSTALLDIR=${INSTALLDIR:-/opt/safing/spn}
|
||||||
PMSTART=${PMSTART:-https://updates.safing.io/latest/linux_${ARCH}/start/portmaster-start}
|
SPNBINARY=${SPNBINARY:-https://updates.safing.io/latest/linux_${ARCH}/hub/spn-hub}
|
||||||
SYSTEMDINSTALLPATH=${SYSTEMDINSTALLPATH:-/etc/systemd/system/spn.service}
|
SYSTEMDINSTALLPATH=${SYSTEMDINSTALLPATH:-/etc/systemd/system/spn.service}
|
||||||
|
|
||||||
if command_exists systemctl; then
|
if command_exists systemctl; then
|
||||||
@@ -98,14 +98,14 @@ ensure_install_dir() {
|
|||||||
mkdir -p ${INSTALLDIR}
|
mkdir -p ${INSTALLDIR}
|
||||||
}
|
}
|
||||||
|
|
||||||
download_pmstart() {
|
download_spnbinary() {
|
||||||
log "Downloading portmaster-start ..."
|
log "Downloading SPN binary ..."
|
||||||
local dest="${INSTALLDIR}/portmaster-start"
|
local dest="${INSTALLDIR}/hub"
|
||||||
if [ -f "${dest}" ]; then
|
if [ -f "${dest}" ]; then
|
||||||
warn "Overwriting existing portmaster-start at ${dest}"
|
warn "Overwriting existing hub at ${dest}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
download_file ${PMSTART} ${dest}
|
download_file ${SPNBINARY} ${dest}
|
||||||
|
|
||||||
log "Changing permissions"
|
log "Changing permissions"
|
||||||
chmod a+x ${dest}
|
chmod a+x ${dest}
|
||||||
@@ -113,7 +113,7 @@ download_pmstart() {
|
|||||||
|
|
||||||
download_updates() {
|
download_updates() {
|
||||||
log "Downloading updates ..."
|
log "Downloading updates ..."
|
||||||
${INSTALLDIR}/portmaster-start --data=${INSTALLDIR} update
|
${INSTALLDIR}/hub update
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_systemd() {
|
setup_systemd() {
|
||||||
@@ -122,7 +122,7 @@ setup_systemd() {
|
|||||||
warn "Skipping setup of systemd service unit"
|
warn "Skipping setup of systemd service unit"
|
||||||
echo "To launch the hub, execute the following as root:"
|
echo "To launch the hub, execute the following as root:"
|
||||||
echo ""
|
echo ""
|
||||||
echo "${INSTALLDIR}/portmaster-start --data ${INSTALLDIR} hub"
|
echo "${INSTALLDIR}/hub"
|
||||||
echo ""
|
echo ""
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -146,7 +146,7 @@ LimitNOFILE=infinity
|
|||||||
Environment=LOGLEVEL=warning
|
Environment=LOGLEVEL=warning
|
||||||
Environment=SPN_ARGS=
|
Environment=SPN_ARGS=
|
||||||
EnvironmentFile=-/etc/default/spn
|
EnvironmentFile=-/etc/default/spn
|
||||||
ExecStart=${INSTALLDIR}/portmaster-start --data ${INSTALLDIR} hub -- --log \$LOGLEVEL \$SPN_ARGS
|
ExecStart=${INSTALLDIR}/hub --log \$LOGLEVEL \$SPN_ARGS
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
@@ -210,7 +210,7 @@ confirm_config() {
|
|||||||
log "Installation configuration:"
|
log "Installation configuration:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Architecture: ${BOLD}${ARCH}${RESET}"
|
echo " Architecture: ${BOLD}${ARCH}${RESET}"
|
||||||
echo " Download-URL: ${BOLD}${PMSTART}${RESET}"
|
echo " Download-URL: ${BOLD}${SPNBINARY}${RESET}"
|
||||||
echo " Target Dir: ${BOLD}${INSTALLDIR}${RESET}"
|
echo " Target Dir: ${BOLD}${INSTALLDIR}${RESET}"
|
||||||
echo "Install systemd: ${BOLD}${INSTALLSYSTEMD}${RESET}"
|
echo "Install systemd: ${BOLD}${INSTALLSYSTEMD}${RESET}"
|
||||||
echo " Unit path: ${BOLD}${SYSTEMDINSTALLPATH}${RESET}"
|
echo " Unit path: ${BOLD}${SYSTEMDINSTALLPATH}${RESET}"
|
||||||
@@ -247,7 +247,7 @@ ${BOLD}Options:${RESET}
|
|||||||
${GREEN}-t, --target PATH${RESET} Configure the installation directory.
|
${GREEN}-t, --target PATH${RESET} Configure the installation directory.
|
||||||
${GREEN}-h, --help${RESET} Display this help text
|
${GREEN}-h, --help${RESET} Display this help text
|
||||||
${GREEN}-a, --arch${RESET} Configure the binary architecture.
|
${GREEN}-a, --arch${RESET} Configure the binary architecture.
|
||||||
${GREEN}-u, --url URL${RESET} Set download URL for portmaster start.
|
${GREEN}-u, --url URL${RESET} Set download URL for spn-hub.
|
||||||
${GREEN}-S, --no-systemd${RESET} Do not install systemd service unit.
|
${GREEN}-S, --no-systemd${RESET} Do not install systemd service unit.
|
||||||
${GREEN}-s, --service-path PATH${RESET} Location for the systemd unit file.
|
${GREEN}-s, --service-path PATH${RESET} Location for the systemd unit file.
|
||||||
EOT
|
EOT
|
||||||
@@ -278,7 +278,7 @@ main() {
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--url | -u)
|
--url | -u)
|
||||||
PMSTART=$2
|
SPNBINARY=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--no-systemd | -S)
|
--no-systemd | -S)
|
||||||
@@ -315,7 +315,7 @@ EOT
|
|||||||
|
|
||||||
# Setup hub
|
# Setup hub
|
||||||
ensure_install_dir
|
ensure_install_dir
|
||||||
download_pmstart
|
download_spnbinary
|
||||||
download_updates
|
download_updates
|
||||||
write_config_file "${INSTALLDIR}/config.json"
|
write_config_file "${INSTALLDIR}/config.json"
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3f45f0814c6db28c3899b39ae0ab01f8f20a8cc98697dbe8039162ccd9590bf8 ./portmaster-start
|
da0ca5ca57f3f5e80a7cb61a8e0ad9b1423051fc12e518b0539c7c69b7a68ee8 ./spn-hub
|
||||||
|
|||||||
Reference in New Issue
Block a user