From c5f87d544b14002f2d67ec0a8572f3e00e487d36 Mon Sep 17 00:00:00 2001 From: Manevolent Date: Tue, 18 May 2021 17:38:32 -0600 Subject: [PATCH] Add daemon support --- Dockerfile | 6 +++--- install.sh | 3 +++ run.sh | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 install.sh create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile index 0fb423d..a4857b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM docker/compose:alpine-1.25.5 MAINTAINER Team Lixo -RUN apk add curl git py-pip && pip install netcalc +RUN apk add gnupg curl git py-pip && pip install netcalc RUN curl -L "https://github.com/gliderlabs/sigil/releases/download/v0.5.0/sigil_0.5.0_$(uname -sm|tr \ _).tgz" | tar -zxC /usr/local/bin VOLUME /etc/lixonet WORKDIR /run ADD . . -RUN chmod +x build.sh +RUN chmod +x run.sh -CMD ["./build.sh"] +CMD ["./run.sh"] diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..620be10 --- /dev/null +++ b/install.sh @@ -0,0 +1,3 @@ +#!/bin/ash + +docker build -t lixonet-ee . && docker run -d -v /etc/bird:/etc/bird/ -v /etc/tinc:/etc/tinc -v /etc/bind:/etc/bind -v /etc/lixonet:/etc/lixonet \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..287d53c --- /dev/null +++ b/run.sh @@ -0,0 +1,22 @@ +#!/bin/ash +delay=900 +version_file=/etc/lixonet/version +while true +do + { + current_version=`cat $version_file || echo 0` + git fetch + latest_commit=`git log "--format=%G? %H" | grep ^G | head -n 1 | cut -d' ' -f2` + git checkout $latest_commit + checkout_version=`cat version` + if [ "$checkout_version" -gt "$current_version" ]; then + echo "Updating to version $checkout_version..." + chmod +x build.sh && ./build.sh + echo "Updated to version $checkout_version." + echo $checkout_version > $version_file + fi + } || { + echo "Failed to update repository. Trying again in $delay seconds." + } + sleep $delay +done \ No newline at end of file