mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Leaner systemctl update
This commit is contained in:
@@ -30,7 +30,7 @@ ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
PYTHON_VIRTUAL_ENV="/home/pi/BirdNET-Pi/birdnet/bin/python3" \
|
||||
my_dir=/home/pi/BirdNET-Pi/scripts \
|
||||
LANGUAGE=en_US:en
|
||||
|
||||
|
||||
# Global LSIO modifications
|
||||
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh"
|
||||
ARG CONFIGLOCATION="/config"
|
||||
@@ -44,9 +44,15 @@ RUN \
|
||||
apt-get update -y && apt-get install curl gcc python3-dev git jq sudo php-mbstring procps -y && \
|
||||
\
|
||||
# Correct for systemctl
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -o /bin/systemctl && \
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -o /helpers/systemctl && \
|
||||
cp -rf /helpers/systemctl /bin/systemctl && \
|
||||
chmod a+x /bin/systemctl && \
|
||||
\
|
||||
# Correct for journalctl
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/journalctl3.py -o /helpers/journalctl && \
|
||||
cp -rf /helpers/journalctl /bin/journalctl && \
|
||||
chmod a+x /bin/journalctl && \
|
||||
\
|
||||
# Change user to pi and create /home/pi
|
||||
echo "setting users" && \
|
||||
if id abc >/dev/null 2>&1; then groupmod -o -g 101 abc && usermod -o -u 101 abc; fi && \
|
||||
|
||||
@@ -30,7 +30,7 @@ ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
PYTHON_VIRTUAL_ENV="/home/pi/BirdNET-Pi/birdnet/bin/python3" \
|
||||
my_dir=/home/pi/BirdNET-Pi/scripts \
|
||||
LANGUAGE=en_US:en
|
||||
|
||||
|
||||
# Global LSIO modifications
|
||||
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh"
|
||||
ARG CONFIGLOCATION="/config"
|
||||
@@ -44,9 +44,15 @@ RUN \
|
||||
apt-get update -y && apt-get install curl gcc python3-dev git jq sudo php-mbstring procps -y && \
|
||||
\
|
||||
# Correct for systemctl
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -o /bin/systemctl && \
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -o /helpers/systemctl && \
|
||||
cp -rf /helpers/systemctl /bin/systemctl && \
|
||||
chmod a+x /bin/systemctl && \
|
||||
\
|
||||
# Correct for journalctl
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/journalctl3.py -o /helpers/journalctl && \
|
||||
cp -rf /helpers/journalctl /bin/journalctl && \
|
||||
chmod a+x /bin/journalctl && \
|
||||
\
|
||||
# Change user to pi and create /home/pi
|
||||
echo "setting users" && \
|
||||
if id abc >/dev/null 2>&1; then groupmod -o -g 101 abc && usermod -o -u 101 abc; fi && \
|
||||
|
||||
@@ -116,10 +116,13 @@ if ! grep -q "/stats/" "$HOME/BirdNET-Pi/homepage/views.php"; then
|
||||
fi
|
||||
|
||||
# Correct systemctl path
|
||||
echo "... updating systemctl path"
|
||||
curl -f -L -s -S https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -o /bin/systemctl || mv /helpers/systemctl3.py /bin/systemctl
|
||||
chown pi:pi /bin/systemctl
|
||||
chmod a+x /bin/systemctl
|
||||
if [ -f /helpers/systemctl ] && [ -f /helpers/journalctl ]; then
|
||||
echo "... updating systemctl and journalctl"
|
||||
cp -rf /helpers/systemctl /bin/systemctl
|
||||
cp -rf /helpers/journalctl /bin/journalctl
|
||||
chown pi:pi /bin/systemctl /bin/journalctl
|
||||
chmod a+x /bin/systemctl /bin/journalctl
|
||||
fi
|
||||
|
||||
# Allow reverse proxy for streamlit
|
||||
echo "... allow reverse proxy for streamlit"
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#! /usr/bin/python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-u', '--unit', metavar='unit', type=str, required=True, help='Systemd unit to display')
|
||||
parser.add_argument('-f', '--follow', default=False, action='store_true', help='Follows the log')
|
||||
parser.add_argument('-n', '--lines', metavar='num', type=int, help='Num of lines to display')
|
||||
parser.add_argument('--no-pager', default=False, action='store_true', help='Do not pipe through a pager')
|
||||
parser.add_argument('--system', default=False, action='store_true', help='Show system units')
|
||||
parser.add_argument('--user', default=False, action='store_true', help='Show user units')
|
||||
parser.add_argument('--root', metavar='path', type=str, help='Use subdirectory path')
|
||||
parser.add_argument('-x', default=False, action='store_true', help='Switch on verbose mode')
|
||||
args = parser.parse_args()
|
||||
|
||||
systemctl_py = "systemctl3.py"
|
||||
path = os.path.dirname(sys.argv[0])
|
||||
systemctl = os.path.join(path, systemctl_py)
|
||||
|
||||
cmd = [ systemctl, "log", args.unit ] # drops the -u
|
||||
if args.follow: cmd += [ "-f" ]
|
||||
if args.lines: cmd += [ "-n", str(args.lines) ]
|
||||
if args.no_pager: cmd += [ "--no-pager" ]
|
||||
if args.system: cmd += [ "--system" ]
|
||||
elif args.user: cmd += [ "--user" ]
|
||||
if args.root: cmd += [ "--root", start(args.root) ]
|
||||
if args.x: cmd += [ "-vvv" ]
|
||||
|
||||
os.execvp(cmd[0], cmd)
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user