mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 04:44:05 +02:00
update
This commit is contained in:
58
webtop_kde/rootfs/etc/scripts/00-data_location.sh
Normal file
58
webtop_kde/rootfs/etc/scripts/00-data_location.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
# Define user
|
||||
PUID=$(bashio::config "PUID")
|
||||
PGID=$(bashio::config "PGID")
|
||||
|
||||
# Check data location
|
||||
LOCATION=$(bashio::config 'data_location')
|
||||
|
||||
if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then
|
||||
# Default location
|
||||
LOCATION="/share/webtop_kde"
|
||||
else
|
||||
bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually"
|
||||
|
||||
# Check if config is located in an acceptable location
|
||||
LOCATIONOK=""
|
||||
for location in "/share" "/config" "/data" "/mnt"; do
|
||||
if [[ "$LOCATION" == "$location"* ]]; then
|
||||
LOCATIONOK=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$LOCATIONOK" ]; then
|
||||
LOCATION=/config/addons_config/${HOSTNAME#*-}
|
||||
bashio::log.fatal "Your data_location value can only be set in /share, /config or /data (internal to addon). It will be reset to the default location : $LOCATION"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Set data location
|
||||
bashio::log.info "Setting data location to $LOCATION"
|
||||
|
||||
sed -i "1a export HOME=$LOCATION" $(find /etc/s6-overlay/s6-rc.d -name "run" -type f)
|
||||
sed -i "1a export FM_HOME=$LOCATION" $(find /etc/s6-overlay/s6-rc.d -name "run" -type f)
|
||||
sed -i "1a export HOME=$LOCATION" /defaults/startwm.sh
|
||||
sed -i "1a export FM_HOME=$LOCATION" /defaults/startwm.sh
|
||||
sed -i "s|/share/webtop_kde|$LOCATION|g" $(find /defaults -type f)
|
||||
sed -i "s|/share/webtop_kde|$LOCATION|g" $(find /etc/cont-init.d -type f)
|
||||
sed -i "s|/share/webtop_kde|$LOCATION|g" $(find /etc/s6-overlay/s6-rc.d -type f)
|
||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/HOME; fi
|
||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$LOCATION" > /var/run/s6/container_environment/FM_HOME; fi
|
||||
{
|
||||
printf "%s" "HOME=\"$LOCATION\""
|
||||
printf "%s" "FM_HOME=\"$LOCATION\""
|
||||
} >> ~/.bashrc
|
||||
|
||||
usermod --home "$LOCATION" abc
|
||||
|
||||
# Create folder
|
||||
echo "Creating $LOCATION"
|
||||
mkdir -p "$LOCATION"
|
||||
|
||||
# Set ownership
|
||||
bashio::log.info "Setting ownership to $PUID:$PGID"
|
||||
chown "$PUID":"$PGID" "$LOCATION"
|
||||
10
webtop_kde/rootfs/etc/scripts/20-folders.sh
Normal file
10
webtop_kde/rootfs/etc/scripts/20-folders.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Define home
|
||||
HOME="/share/webtop_kde"
|
||||
mkdir -p $HOME
|
||||
chown -R abc:abc $HOME
|
||||
|
||||
#adduser USERNAME
|
||||
#useradd -m abc -p abc
|
||||
57
webtop_kde/rootfs/etc/scripts/80-configuration.sh
Normal file
57
webtop_kde/rootfs/etc/scripts/80-configuration.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2015
|
||||
|
||||
# Install rpi video drivers
|
||||
#if bashio::config.true 'rpi_video_drivers'; then
|
||||
# bashio::log.info "Installing Rpi graphic drivers"
|
||||
# apk add --no-cache mesa-dri-vc4 mesa-dri-swrast mesa-gbm xf86-video-fbdev >/dev/null && bashio::log.green "... done" ||
|
||||
# bashio::log.red "... not successful. Are you on a rpi?"
|
||||
#fi
|
||||
|
||||
# Fix mate software center
|
||||
#if [ -f /usr/lib/dbus-1.0/dbus-daemon-launch-helper ]; then
|
||||
# echo "Allow software center"
|
||||
# chmod u+s /usr/lib/dbus-1.0/dbus-daemon-launch-helper
|
||||
# service dbus restart
|
||||
#fi
|
||||
|
||||
# Install specific apps
|
||||
if bashio::config.has_value 'additional_apps'; then
|
||||
bashio::log.info "Installing additional apps :"
|
||||
# hadolint ignore=SC2005
|
||||
NEWAPPS=$(bashio::config 'additional_apps')
|
||||
for APP in ${NEWAPPS//,/ }; do
|
||||
bashio::log.green "... $APP"
|
||||
# shellcheck disable=SC2015
|
||||
if command -v "apk" &>/dev/null; then
|
||||
apk add --no-cache "$APP" >/dev/null || bashio::log.red "... not successful, please check package name"
|
||||
elif command -v "apt" &>/dev/null; then
|
||||
apt-get install -yqq --no-install-recommends "$APP" >/dev/null || bashio::log.red "... not successful, please check package name"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Set TZ
|
||||
if bashio::config.has_value 'TZ'; then
|
||||
TIMEZONE=$(bashio::config 'TZ')
|
||||
bashio::log.info "Setting timezone to $TIMEZONE"
|
||||
ln -snf /usr/share/zoneinfo/"$TIMEZONE" /etc/localtime && echo "$TIMEZONE" >/etc/timezone
|
||||
fi
|
||||
|
||||
# Set keyboard
|
||||
if bashio::config.has_value 'KEYBOARD'; then
|
||||
KEYBOARD=$(bashio::config 'KEYBOARD')
|
||||
bashio::log.info "Setting keyboard to $KEYBOARD"
|
||||
sed -i "1a export KEYBOARD=$KEYBOARD" /etc/s6-overlay/s6-rc.d/svc-web/run
|
||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$KEYBOARD" > /var/run/s6/container_environment/KEYBOARD; fi
|
||||
printf "%s" "KEYBOARD=\"$KEYBOARD\"" >> ~/.bashrc
|
||||
fi
|
||||
|
||||
# Set password
|
||||
if bashio::config.has_value 'PASSWORD'; then
|
||||
bashio::log.info "Setting password to the value defined in options"
|
||||
PASSWORD=$(bashio::config 'PASSWORD')
|
||||
passwd -d abc
|
||||
echo -e "$PASSWORD\n$PASSWORD" | passwd abc
|
||||
fi
|
||||
20
webtop_kde/rootfs/etc/scripts/90-ingress.sh
Normal file
20
webtop_kde/rootfs/etc/scripts/90-ingress.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
#################
|
||||
# NGINX SETTING #
|
||||
#################
|
||||
|
||||
cp /defaults/default.conf /etc/nginx/http.d/ingress.conf
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
#ingress_interface=$(bashio::addon.ip_address)
|
||||
sed -i "s/3001/0001/g" /etc/nginx/http.d/ingress.conf
|
||||
sed -i "s/3000/${ingress_port}/g" /etc/nginx/http.d/ingress.conf
|
||||
#sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/sites-available/ingress.conf
|
||||
|
||||
nginx -s reload &>/dev/null || true
|
||||
|
||||
# Implement SUBFOLDER value
|
||||
sed -i "1a SUBFOLDER=$(bashio::addon.ingress_url)" $(find /etc/s6-overlay/s6-rc.d -name "run" -type f)
|
||||
Reference in New Issue
Block a user