Avoid hardcode pi

This commit is contained in:
Alexandre
2024-04-27 11:24:19 +02:00
parent d73f4dfc23
commit a200a527ed

View File

@@ -42,14 +42,14 @@ RUN \
# Change user to pi and create /home/pi # Change user to pi and create /home/pi
echo "setting users" && \ echo "setting users" && \
groupmod -o -g 101 abc && usermod -o -u 101 abc && \ groupmod -o -g 101 abc && usermod -o -u 101 abc && \
groupadd --non-unique -g 1000 pi && \ groupadd --non-unique -g 1000 "$USER" && \
useradd --non-unique --uid 1000 --gid 1000 -m pi && \ useradd --non-unique --uid 1000 --gid 1000 -m "$USER" && \
\ \
# Ensure permissions # Ensure permissions
echo "setting permissions" && \ echo "setting permissions" && \
echo "pi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ echo "$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
mkdir -p /home/pi/.config/matplotlib && \ mkdir -p "$HOME"/.config/matplotlib && \
chown -R 1000:1000 /home/pi && \ chown -R 1000:1000 "$HOME" && \
\ \
# Download installer # Download installer
curl -f -L -s -S "https://raw.githubusercontent.com/Nachtzuster/BirdNET-Pi/main/newinstaller.sh" -o /newinstaller.sh && \ curl -f -L -s -S "https://raw.githubusercontent.com/Nachtzuster/BirdNET-Pi/main/newinstaller.sh" -o /newinstaller.sh && \
@@ -80,12 +80,12 @@ RUN \
#sed -i -e "s|== 0|== 7|g" -e "s|sudo -n true|true|g" -e "s|sudo -K|true|g" /newinstaller.sh && \ #sed -i -e "s|== 0|== 7|g" -e "s|sudo -n true|true|g" -e "s|sudo -K|true|g" /newinstaller.sh && \
\ \
# Execute installer # Execute installer
sudo -u pi /./newinstaller.sh && \ sudo -u "$USER" /./newinstaller.sh && \
\ \
# Adapt for lsio usage of /app # Adapt for lsio usage of /app
if [ -d /app ]; then rm -r /app; fi && \ if [ -d /app ]; then rm -r /app; fi && \
ln -s /home/pi /app && \ ln -s "$HOME" /app && \
chown -R 1000:1000 /home/pi /app chown -R 1000:1000 "$HOME" /app
################## ##################
# 2 Modify Image # # 2 Modify Image #