Add daemon support

This commit is contained in:
Manevolent 2021-05-18 17:38:32 -06:00
parent b7dee82b66
commit c5f87d544b
No known key found for this signature in database
GPG Key ID: 2E9B7592DFA4F344
3 changed files with 28 additions and 3 deletions

View File

@ -1,13 +1,13 @@
FROM docker/compose:alpine-1.25.5
MAINTAINER Team Lixo <lixonet@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"]

3
install.sh Normal file
View File

@ -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

22
run.sh Normal file
View File

@ -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