Can now be installed to /opt and run as a openrc service
This commit is contained in:
14
dyfi-openrc.sh
Executable file
14
dyfi-openrc.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
log_file="/opt/dyfi/log"
|
||||||
|
|
||||||
|
command="/opt/dyfi/run.sh"
|
||||||
|
command_args="--log ${log_file} --auth /opt/dyfi/auth"
|
||||||
|
command_background=true
|
||||||
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||||||
|
|
||||||
|
extra_commands="log"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
cat "$log_file"
|
||||||
|
}
|
||||||
32
install.sh
Executable file
32
install.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/env sh
|
||||||
|
|
||||||
|
dyfi_dir=$(dirname "$(realpath "$0")")
|
||||||
|
install_dir='/opt/dyfi/'
|
||||||
|
|
||||||
|
|
||||||
|
sudo -- sh -c "\
|
||||||
|
alias 'cp'='cp --verbose'; \
|
||||||
|
alias 'mkdir'='mkdir --verbose'; \
|
||||||
|
|
||||||
|
cd "$dyfi_dir"; \
|
||||||
|
|
||||||
|
mkdir -p /opt/dyfi; \
|
||||||
|
cp ./auth "$install_dir"; \
|
||||||
|
cp ./dyfi.py "$install_dir"; \
|
||||||
|
cp ./run.sh "$install_dir"; \
|
||||||
|
cp ./requirements.txt "$install_dir"; \
|
||||||
|
cp ./dyfi-openrc.sh /etc/init.d/dyfi; \
|
||||||
|
|
||||||
|
cd "$install_dir"; \
|
||||||
|
|
||||||
|
python -m venv ./venv; \
|
||||||
|
source ./venv/bin/activate; \
|
||||||
|
python -m ensurepip; \
|
||||||
|
pip install --upgrade pip; \
|
||||||
|
pip install -r ./requirements.txt; \
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
./uninstall.sh
|
||||||
|
fi
|
||||||
10
run.sh
Executable file
10
run.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/env sh
|
||||||
|
|
||||||
|
path=$(dirname "$(realpath "$0")")
|
||||||
|
|
||||||
|
cd $path
|
||||||
|
|
||||||
|
source ./venv/bin/activate
|
||||||
|
|
||||||
|
python ./dyfi.py $@
|
||||||
|
|
||||||
10
uninstall.sh
Executable file
10
uninstall.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/env sh
|
||||||
|
|
||||||
|
install_dir=/opt/dyfi/
|
||||||
|
|
||||||
|
sudo -- sh -c "\
|
||||||
|
alias 'rm'='rm --verbose --preserve-root'; \
|
||||||
|
|
||||||
|
rm -rf ${install_dir}; \
|
||||||
|
rm -f /etc/init.d/dyfi; \
|
||||||
|
"
|
||||||
Reference in New Issue
Block a user