This commit is contained in:
Alexandre
2023-08-04 19:47:24 +02:00
committed by GitHub
parent 6d6bb6da7d
commit db84b93323
7 changed files with 2 additions and 233 deletions

View File

@@ -1,70 +0,0 @@
#include <tunables/global>
profile webtop_kde_addon flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
capability,
file,
signal,
mount,
umount,
remount,
network udp,
network tcp,
network dgram,
network stream,
network inet,
network inet6,
network netlink raw,
network unix dgram,
capability setgid,
capability setuid,
capability sys_admin,
capability dac_read_search,
capability dac_override,
# capability sys_rawio,
# S6-Overlay
/init ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/run/{,**} rwk,
/dev/tty rw,
/bin/** ix,
/usr/bin/** ix,
/usr/lib/bashio/** ix,
/etc/s6/** rix,
/run/s6/** rix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/init rix,
/var/run/** mrwkl,
/var/run/ mrwkl,
/dev/i2c-1 mrwkl,
# Files required
/dev/fuse mrwkl,
/dev/sda1 mrwkl,
/dev/sdb1 mrwkl,
/dev/nvme0 mrwkl,
/dev/nvme1 mrwkl,
/dev/mmcblk0p1 mrwkl,
/dev/* mrwkl,
/udev/* mrwkl,
/tmp/** mrkwl,
/dev/fuse/** mrkwl,
/dev/** mrkwl,
/sys/firmware/** mrkwl,
# Data access
/data/** rw,
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
ptrace (trace,read) peer=docker-default,
# docker daemon confinement requires explict allow rule for signal
signal (receive) set=(kill,term) peer=/usr/bin/docker,
}

View File

@@ -19,6 +19,6 @@
},
"slug": "webtop-kde",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "5.24.5-test12",
"version": "5.24.5-test13",
"video": true
}
}

View File

@@ -1,16 +0,0 @@
#!/bin/bash
echo "Starting..."
####################
# Starting scripts #
####################
for SCRIPTS in /etc/cont-init.d/*; do
[ -e "$SCRIPTS" ] || continue
echo "$SCRIPTS: executing"
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x "$SCRIPTS"
# Change shebang if no s6 supervision
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
done

View File

@@ -1,58 +0,0 @@
#!/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"

View File

@@ -1,10 +0,0 @@
#!/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

View File

@@ -1,57 +0,0 @@
#!/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

View File

@@ -1,20 +0,0 @@
#!/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)