Compare commits
2 Commits
3af4546839
...
c42c636231
| Author | SHA1 | Date | |
|---|---|---|---|
| c42c636231 | |||
| 99b21dbe8e |
+16
-13
@@ -44,21 +44,26 @@ if [ -z "$(grep "\bjoeac.net\b" /etc/group)" ]
|
||||
then
|
||||
sudo adduser -D -h /home/joeac.net joeac.net
|
||||
sudo adduser joeac.net joeac.net
|
||||
sudo adduser $(whoami) joeac.net
|
||||
su -l $(whoami)
|
||||
fi
|
||||
|
||||
if ! ( expr "$(groups joeac.net)" wheel )
|
||||
then
|
||||
sudo adduser joeac.net wheel
|
||||
fi
|
||||
|
||||
su -l joeac.net
|
||||
if ! [ $(whoami) = "joeac.net" ]
|
||||
then
|
||||
echo "Could not log in to user: joeac.net. Log in manually and re-run this script as joeac.net."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -d /home/joeac.net/joeac.net/.git ]
|
||||
then
|
||||
sudo -u joeac.net git clone https://git.joeac.net/joeac/joeac.net.git /home/joeac.net/joeac.net
|
||||
git clone https://git.joeac.net/joeac/joeac.net.git /home/joeac.net/joeac.net
|
||||
fi
|
||||
sudo chown joeac.net:joeac.net /home/joeac.net/joeac.net
|
||||
sudo chmod 770 /home/joeac.net/joeac.net
|
||||
|
||||
if ! [ -h /usr/local/lib/joeac.net ]
|
||||
then
|
||||
sudo ln -s /home/joeac.net/joeac.net /usr/local/lib/joeac.net
|
||||
fi
|
||||
sudo chmod 770 /home/joeac.netjoeac.net
|
||||
|
||||
if ! [ -f DIGITALOCEAN_TOKEN ]
|
||||
then
|
||||
@@ -79,8 +84,6 @@ then
|
||||
unset REMOTE_SMTP_PASSWORD
|
||||
fi
|
||||
|
||||
sudo -u joeac.net touch /home/joeac.net/joeac.net/.env
|
||||
sudo -u joeac.net chmod 760 /home/joeac.net/joeac.net/.env
|
||||
while read line
|
||||
do
|
||||
if expr "${line}" : "[[:alnum:]_]\+=" 1>/dev/null
|
||||
@@ -106,5 +109,5 @@ do
|
||||
fi
|
||||
done </home/joeac.net/joeac.net/example.env
|
||||
|
||||
sudo -u joeac.net make --directory=/home/joeac.net/joeac.net
|
||||
sudo -u joeac.net make --directory=/home/joeac.net/joeac.net install
|
||||
make --directory=/home/joeac.net/joeac.net
|
||||
make --directory=/home/joeac.net/joeac.net install
|
||||
|
||||
+6
-17
@@ -29,10 +29,10 @@ $(foreach module,$(ALL_MODULES), $(eval $(uninstall_dyndns_module_rule)))
|
||||
remove_/etc/periodic/daily/dyndns-%.joeac.net:
|
||||
rm -f $(@:remove_%=%)
|
||||
|
||||
/etc/periodic/daily/dyndns-%joeac.net: /usr/local/bin/dyndns.sh ~/.config/dyndns/DIGITALOCEAN_TOKEN
|
||||
/etc/periodic/daily/dyndns-%joeac.net: ~/digitalocean_dyndns/dyndns.sh ~/.config/dyndns/DIGITALOCEAN_TOKEN
|
||||
echo "#!/bin/sh" > crontab.tmp
|
||||
echo " /usr/local/bin/dyndns.sh 4 $(*F)joeac.net" >> crontab.tmp
|
||||
echo "CONN_DEVICE_NAME=eth0 /usr/local/bin/dyndns.sh 6 $(*F)joeac.net" >> crontab.tmp
|
||||
echo " $(shell realpath ~)/digitalocean_dyndns/dyndns.sh 4 $(*F)joeac.net" >> crontab.tmp
|
||||
echo "CONN_DEVICE_NAME=eth0 $(shell realpath ~)/digitalocean_dyndns/dyndns.sh 6 $(*F)joeac.net" >> crontab.tmp
|
||||
sudo mv crontab.tmp $@
|
||||
sudo chmod +x $@
|
||||
|
||||
@@ -42,23 +42,12 @@ reinstall_dyndns: $(addprefix remove_,$(dyndns_crontabs_to_remove))
|
||||
.PHONY: uninstall_dyndns
|
||||
uninstall_dyndns: $(foreach module,$(ALL_MODULES),$(uninstall_dyndns_$(module)))
|
||||
sudo rm -rf \
|
||||
/usr/local/bin/dyndns.sh \
|
||||
/usr/local/bin/get_ip_addr.sh \
|
||||
/usr/local/lib/digitalocean_dyndns/ \
|
||||
~/digitalocean_dyndns/ \
|
||||
~/.config/dyndns \
|
||||
~/.cache/dyndns
|
||||
|
||||
/usr/local/bin/dyndns.sh: /usr/local/lib/digitalocean_dyndns/dyndns.sh /usr/local/bin/get_ip_addr.sh
|
||||
sudo rm -f /usr/local/bin/dyndns.sh
|
||||
sudo cp /usr/local/lib/digitalocean_dyndns/dyndns.sh /usr/local/bin/dyndns.sh
|
||||
|
||||
/usr/local/bin/get_ip_addr.sh: /usr/local/lib/digitalocean_dyndns/get_ip_addr.sh
|
||||
sudo rm -f /usr/local/bin/get_ip_addr.sh
|
||||
sudo cp /usr/local/lib/digitalocean_dyndns/get_ip_addr.sh /usr/local/bin/get_ip_addr.sh
|
||||
|
||||
/usr/local/lib/digitalocean_dyndns/%:
|
||||
cd /usr/local/lib \
|
||||
&& sudo git clone https://git.joeac.net/joeac/digitalocean_dyndns.git
|
||||
~/digitalocean_dyndns/%:
|
||||
git clone https://git.joeac.net/joeac/digitalocean_dyndns.git ~/digitalocean_dyndns
|
||||
|
||||
~/.config/dyndns/DIGITALOCEAN_TOKEN: DIGITALOCEAN_TOKEN
|
||||
mkdir -p ~/.config/dyndns/
|
||||
|
||||
+2
-1
@@ -65,7 +65,8 @@ $(foreach module,$(MODULES),$(eval $(openrc_restart_rule)))
|
||||
sudo ln -s /etc/init.d/user /etc/init.d/user.$(USER)
|
||||
|
||||
/etc/conf.d/user.$(USER): openrc/conf.d/user.template
|
||||
sudo USER=$(USER) envsubst -i openrc/conf.d/user.template -o /etc/conf.d/user.$(USER)
|
||||
USER=$(USER) envsubst -i openrc/conf.d/user.template -o openrc/conf.d/user.$(USER)
|
||||
sudo mv openrc/conf.d/user.$(USER) /etc/conf.d/user.$(USER)
|
||||
sudo rc-update add user.$(USER) default
|
||||
|
||||
.PHONY: uninstall_joeac.net_service
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
# https://gist.github.com/itzwam/2069e935385193207f7e5bea7156e21d
|
||||
# https://github.com/0x17de/dockerservice-openrc
|
||||
|
||||
: ${HOME:=/home/joeac.net}
|
||||
: ${MODULENAME:=${RC_SVCNAME##*.}}
|
||||
: ${SRCDIR:=/usr/local/lib/joeac.net}
|
||||
: ${SRCDIR:=$HOME/joeac.net}
|
||||
DOCKER_COMPOSE_UP_ARGS=${DOCKER_COMPOSE_UP_ARGS-"--no-build --no-recreate --no-deps"}
|
||||
|
||||
[ -z "${MODULENAME}" ] && exit 1
|
||||
|
||||
Reference in New Issue
Block a user