Delete tvheadend directory
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# make folders
|
||||
#mkdir -p \
|
||||
# /config/comskip
|
||||
|
||||
# copy config
|
||||
#[[ ! -e /config/dvr/config ]] && \
|
||||
# (mkdir -p /config/dvr/config && cp /defaults/7a5edfbe189851e5b1d1df19c93962f0 /config/dvr/config/7a5edfbe189851e5b1d1df19c93962f0)
|
||||
#[[ ! -e /config/comskip/comskip.ini ]] && \
|
||||
# cp /defaults/comskip.ini.org /config/comskip/comskip.ini
|
||||
#[[ ! -e /config/config ]] && \
|
||||
# (cp /defaults/config /config/config)
|
||||
|
||||
# extract picons on first run
|
||||
#[[ -f /picons.tar.bz2 ]] && \
|
||||
# mkdir -p /picons
|
||||
# tar xf \
|
||||
# /picons.tar.bz2 -C \
|
||||
# /picons &&
|
||||
# rm -f /picons.tar.bz2
|
||||
|
||||
# function to randomly sample 5 files for their owner and only chown if not abc
|
||||
#chowner () {
|
||||
#files=(${1}/*)
|
||||
#for i in {1..5}; do
|
||||
# user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}"))
|
||||
# if [ "${user}" != "abc" ]; then
|
||||
# chown -R abc:abc ${1}
|
||||
# break
|
||||
# fi
|
||||
#done
|
||||
#}
|
||||
|
||||
# permissions
|
||||
#echo "Setting permissions"
|
||||
#abc_dirs=( \
|
||||
#/config \
|
||||
#/picons \
|
||||
#)
|
||||
#for i in "${abc_dirs[@]}"; do
|
||||
# if [ "$(ls -A ${i})" ]; then
|
||||
# chowner ${i}
|
||||
# else
|
||||
# chown -R abc:abc ${i}
|
||||
# fi
|
||||
#done
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
FILES=$(find /dev/dri /dev/dvb -type c -print 2>/dev/null)
|
||||
|
||||
for i in $FILES
|
||||
do
|
||||
VIDEO_GID=$(stat -c '%g' "$i")
|
||||
if id -G abc | grep -qw "$VIDEO_GID"; then
|
||||
touch /groupadd
|
||||
else
|
||||
if [ ! "${VIDEO_GID}" == '0' ]; then
|
||||
VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}')
|
||||
if [ -z "${VIDEO_NAME}" ]; then
|
||||
VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-z0-9' | head -c8)"
|
||||
groupadd "$VIDEO_NAME"
|
||||
groupmod -g "$VIDEO_GID" "$VIDEO_NAME"
|
||||
fi
|
||||
usermod -a -G "$VIDEO_NAME" abc
|
||||
touch /groupadd
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${FILES}" ] && [ ! -f "/groupadd" ]; then
|
||||
usermod -a -G root abc
|
||||
fi
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: TVHeadend
|
||||
# Executes user customizations on startup
|
||||
# ==============================================================================
|
||||
|
||||
# Install user configured/requested packages
|
||||
if bashio::config.has_value 'system_packages'; then
|
||||
apk update \
|
||||
|| bashio::exit.nok 'Failed updating Alpine packages repository indexes'
|
||||
|
||||
for package in $(bashio::config 'system_packages'); do
|
||||
apk add "$package" \
|
||||
|| bashio::exit.nok "Failed installing system package ${package}"
|
||||
done
|
||||
fi
|
||||
|
||||
# Executes user commands on startup
|
||||
if bashio::config.has_value 'init_commands'; then
|
||||
while read -r cmd; do
|
||||
eval "${cmd}" \
|
||||
|| bashio::exit.nok "Failed executing init command: ${cmd}"
|
||||
done <<< "$(bashio::config 'init_commands')"
|
||||
fi
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: TVHeadend
|
||||
# Executes user customizations on startup
|
||||
# ==============================================================================
|
||||
|
||||
check_picons(){
|
||||
if [ -z "$(ls -A /config/tvheadend/picons)" ]; then return 1; else return 0; fi
|
||||
}
|
||||
|
||||
picons_install(){
|
||||
if apk update; then
|
||||
bashio::log.info '[Picons] APK: Installing required packages.'
|
||||
if apk add --no-cache --virtual .build-deps xz; then
|
||||
bashio::log.info '[Picons] Installing Picons.'
|
||||
bashio::log.info '[Picons] SNP-Picons Download.'
|
||||
wget -O /config/tvheadend/snp.tar.xz $(bashio::config 'snp_url')
|
||||
bashio::log.info '[Picons] SRP-Picons Download.'
|
||||
wget -O /config/tvheadend/srp.tar.xz $(bashio::config 'srp_url')
|
||||
bashio::log.info '[Picons] SNP-Picons extract.'
|
||||
mkdir -p /config/tvheadend/picons/snp
|
||||
tar -xf /config/tvheadend/snp.tar.xz --strip-components=1 -C /config/tvheadend/picons/snp
|
||||
rm /config/tvheadend/snp.tar.xz
|
||||
bashio::log.info '[Picons] SRP-Picons extract.'
|
||||
mkdir -p /config/tvheadend/picons/srp
|
||||
tar -xf /config/tvheadend/srp.tar.xz --strip-components=1 -C /config/tvheadend/picons/srp
|
||||
rm /config/tvheadend/srp.tar.xz
|
||||
bashio::log.info '[Picons] Update config.'
|
||||
sed -i 's|.*chiconpath.*| "chiconpath": "file:///config/tvheadend/picons/snp/%C.png",|g' /config/tvheadend/config
|
||||
sed -i 's|.*piconpath.*| "piconpath": "file:///config/tvheadend/picons/srp",|g' /config/tvheadend/config
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_webgrabplus(){
|
||||
if [ -z "$(ls -A /config/tvheadend/wg++)" ]; then return 1; else return 0; fi
|
||||
}
|
||||
|
||||
webgrabplus_install(){
|
||||
if apk update; then
|
||||
bashio::log.info '[Webgrab+] APK: Installing required packages.'
|
||||
if apk add --no-cache --virtual .build-deps git mono --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing; then
|
||||
bashio::log.info '[Webgrab+] Installing Webgrab+.'
|
||||
cd /tmp \
|
||||
&& wget http://webgrabplus.com/sites/default/files/download/SW/V3.2.0/WebGrabPlus_V3.2_install.tar.gz \
|
||||
&& tar -zxvf WebGrabPlus_V3.2_install.tar.gz \
|
||||
&& rm WebGrabPlus_V3.2_install.tar.gz \
|
||||
&& mv .wg++/ /config/tvheadend/wg++ \
|
||||
&& cd /config/tvheadend/wg++ \
|
||||
&& ./install.sh \
|
||||
&& rm -rf siteini.pack/ \
|
||||
&& wget http://webgrabplus.com/sites/default/files/download/ini/SiteIniPack_current.zip \
|
||||
&& unzip SiteIniPack_current.zip \
|
||||
&& rm SiteIniPack_current.zip \
|
||||
&& cp siteini.pack/India/* siteini.user/ \
|
||||
&& wget -O /usr/bin/tv_grab_wg++ http://www.webgrabplus.com/sites/default/files/tv_grab_wg.txt \
|
||||
&& sed -i 's|~/.wg++/guide.xml|/config/tvheadend/wg++/guide.xml|g' /usr/bin/tv_grab_wg++ \
|
||||
&& chmod a+x /usr/bin/tv_grab_wg++
|
||||
else
|
||||
bashio::log.info '[Webgrab+] APK: Critical error. Unable install required packages.'
|
||||
exit 1
|
||||
fi
|
||||
bashio::log.info '[Webgrab+] APK: Removing packages no longer required.'
|
||||
apk del --no-cache --purge .build-deps
|
||||
else
|
||||
bashio::log.error '[Webgrab+] APK: Critical error. Unable to update pkg list. Check connectivity.'
|
||||
exit 1
|
||||
fi
|
||||
bashio::log.info '[Webgrab+] Finsihed all APK and PIP3 updates and installs.'
|
||||
}
|
||||
|
||||
# Ensure directory exists
|
||||
if ! bashio::fs.directory_exists '/config/tvheadend/'; then
|
||||
bashio::log.info "Creating default configuration directory at /config/tvheadend/"
|
||||
timeout 20s /usr/bin/tvheadend --firstrun -u root -g root -c /config/tvheadend
|
||||
fi
|
||||
|
||||
if check_picons; then
|
||||
bashio::log.info "[Picons] Picons already installed"
|
||||
else
|
||||
bashio::log.info "[Picons] No Picons installation found"
|
||||
if [ $(bashio::config 'picons') = true ]; then
|
||||
bashio::log.info "[Picons] Installing Picons"
|
||||
picons_install
|
||||
chmod +x /usr/bin/restart_addon
|
||||
exec /usr/bin/restart_addon
|
||||
fi
|
||||
fi
|
||||
|
||||
if check_webgrabplus; then
|
||||
bashio::log.info "[Webgrab+] Webgrab+ already installed"
|
||||
else
|
||||
bashio::log.info "[Webgrab+] No webgrab+ installation found"
|
||||
if [ $(bashio::config 'webgrabplus') = true ]; then
|
||||
bashio::log.info "[Webgrab+] Installing webgrab+"
|
||||
webgrabplus_install
|
||||
chmod +x /usr/bin/restart_addon
|
||||
exec /usr/bin/restart_addon
|
||||
fi
|
||||
fi
|
||||
|
||||
bashio::log.info 'Setup completed without errors!!'
|
||||
Reference in New Issue
Block a user