From dc791623d568c3e0de113b7dbf99253a4d2e2cd5 Mon Sep 17 00:00:00 2001 From: alexbelgium Date: Wed, 16 Mar 2022 09:56:19 +0000 Subject: [PATCH] Beautify bash --- .templates/00-aaa_dockerfile_backup.sh | 18 +- .templates/00-global_var.sh | 32 +-- .templates/90-config_yaml.sh | 12 +- .templates/90-dns_set.sh | 32 +-- .templates/92-local_mounts.sh | 38 +-- .templates/92-smb_mounts.sh | 148 +++++----- .templates/99-custom_script.sh | 2 +- .templates/automatic_packages.sh | 2 +- addons_updater/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/99-run.sh | 270 +++++++++--------- arpspoof/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- bazarr/rootfs/etc/cont-init.d/20-folders.sh | 34 +-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- cloudcommander/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/99-run.sh | 12 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- emby/rootfs/etc/cont-init.d/20-folders.sh | 96 +++---- enedisgateway2mqtt/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/99-run.sh | 64 ++--- enedisgateway2mqtt_dev/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/99-run.sh | 64 ++--- filebrowser/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/20-folders.sh | 16 +- filebrowser/rootfs/etc/cont-init.d/99-run.sh | 48 ++-- fireflyiii/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- fireflyiii/rootfs/etc/cont-init.d/99-run.sh | 148 +++++----- fireflyiii_data_importer/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- flaresolverr/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- gazpar2mqtt/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 20 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- grav/rootfs/etc/cont-init.d/20-folders.sh | 6 +- inadyn/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- jackett/rootfs/etc/cont-init.d/20-folders.sh | 24 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- jellyfin/rootfs/etc/cont-init.d/20-folders.sh | 76 ++--- .../etc/cont-init.d/99-database_clean.sh | 2 +- joal/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- joal/rootfs/etc/cont-init.d/99-run.sh | 24 +- joplin/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- joplin/rootfs/etc/cont-init.d/99-run.sh | 50 ++-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- lidarr/rootfs/etc/cont-init.d/20-folders.sh | 28 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- nextcloud/rootfs/defaults/nextcloud-perms.sh | 8 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/10-adduser.sh | 2 +- nextcloud/rootfs/etc/cont-init.d/30-keygen.sh | 40 +-- nextcloud/rootfs/etc/cont-init.d/40-config.sh | 18 +- .../rootfs/etc/cont-init.d/50-install.sh | 16 +- .../rootfs/etc/cont-init.d/60-memcache.sh | 4 +- .../rootfs/etc/cont-init.d/99-add_packages.sh | 12 +- .../etc/cont-init.d/99-trusted_domains.sh | 10 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- nzbget/rootfs/etc/cont-init.d/20-folders.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- ombi/rootfs/etc/cont-init.d/20-folders.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- organizr/rootfs/etc/cont-init.d/00-folders.sh | 6 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/20-folders.sh | 18 +- .../rootfs/etc/cont-init.d/93-multiocr.sh | 20 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/00-folders.sh | 6 +- .../etc/cont-init.d/99-configuration.sh | 12 +- photoprism/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- photoprism/rootfs/etc/cont-init.d/99-run.sh | 80 +++--- photoprism/rootfs/run.sh | 36 +-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- piwigo/rootfs/etc/cont-init.d/41-folders.sh | 36 +-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- plex/rootfs/etc/cont-init.d/21-folders.sh | 16 +- .../rootfs/etc/cont-init.d/90-create_links.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../etc/cont-init.d/20-configuration.sh | 4 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_portainer_install.sh | 2 +- portainer/rootfs/etc/cont-init.d/30-nginx.sh | 6 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- prowlarr/rootfs/etc/cont-init.d/20-folders.sh | 16 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/30-nginx.sh | 2 +- .../91-qbittorrent_configuration.sh | 82 +++--- .../rootfs/etc/cont-init.d/93-openvpn.sh | 124 ++++---- qbittorrent/rootfs/etc/openvpn/down.sh | 28 +- qbittorrent/rootfs/etc/openvpn/up.sh | 92 +++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- radarr/rootfs/etc/cont-init.d/20-folders.sh | 28 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- readarr/rootfs/etc/cont-init.d/20-folders.sh | 28 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- scrutiny/rootfs/etc/cont-init.d/31-run.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- sonarr/rootfs/etc/cont-init.d/20-folders.sh | 28 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- tandoor_recipes/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/20-folders.sh | 4 +- .../rootfs/etc/cont-init.d/99-run.sh | 74 ++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/19-config.sh | 56 ++-- ubooquity/rootfs/etc/32-nginx_ingress.sh | 16 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../rootfs/etc/cont-init.d/20-folders.sh | 18 +- .../rootfs/etc/cont-init.d/32-nginx_ssl.sh | 14 +- .../rootfs/etc/cont-init.d/93-custom_webUI.sh | 38 +-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../etc/cont-init.d/00-data_location.sh | 28 +- .../etc/cont-init.d/80-configuration.sh | 50 ++-- webtrees/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- webtrees/rootfs/etc/cont-init.d/99-run.sh | 52 ++-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- whoogle/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- zoneminder/rootfs/entrypoint.sh | 22 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 +- zoneminder/rootfs/etc/cont-init.d/99-run.sh | 100 +++---- 146 files changed, 2017 insertions(+), 2017 deletions(-) diff --git a/.templates/00-aaa_dockerfile_backup.sh b/.templates/00-aaa_dockerfile_backup.sh index f4b6a3262..08497f0e2 100644 --- a/.templates/00-aaa_dockerfile_backup.sh +++ b/.templates/00-aaa_dockerfile_backup.sh @@ -12,10 +12,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -26,9 +26,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/.templates/00-global_var.sh b/.templates/00-global_var.sh index 4726b1259..206ab8172 100644 --- a/.templates/00-global_var.sh +++ b/.templates/00-global_var.sh @@ -13,18 +13,18 @@ JSONSOURCE="/data/options.json" mapfile -t arr < <(jq -r 'keys[]' "${JSONSOURCE}") for KEYS in "${arr[@]}"; do - # export key - VALUE=$(jq ."$KEYS" "${JSONSOURCE}") - line="${KEYS}='${VALUE//[\"\']/}'" - # Use locally - if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then - bashio::log.blue "${KEYS}=******" - else - bashio::log.blue "$line" - fi - # Export the variable to run scripts - if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi - if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi + # export key + VALUE=$(jq ."$KEYS" "${JSONSOURCE}") + line="${KEYS}='${VALUE//[\"\']/}'" + # Use locally + if bashio::config.false "verbose" || [[ "${KEYS}" == *"PASS"* ]]; then + bashio::log.blue "${KEYS}=******" + else + bashio::log.blue "$line" + fi + # Export the variable to run scripts + if cat /etc/services.d/*/*run* &>/dev/null; then sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null; fi + if cat /etc/cont-init.d/*run* &>/dev/null; then sed -i "1a export $line" /etc/cont-init.d/*run* 2>/dev/null; fi done ################ @@ -32,8 +32,8 @@ done ################ set +e if [ -n "$TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/"$TZ" ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone - fi + if [ -f /usr/share/zoneinfo/"$TZ" ]; then + echo "Timezone set from $(cat /etc/timezone) to $TZ" + ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" >/etc/timezone + fi fi diff --git a/.templates/90-config_yaml.sh b/.templates/90-config_yaml.sh index 03dbe2aa1..1f0e73a19 100644 --- a/.templates/90-config_yaml.sh +++ b/.templates/90-config_yaml.sh @@ -68,11 +68,11 @@ function parse_yaml { local prefix=$2 || local prefix="" local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') sed -ne "s|^\($s\):|\1|" \ - -e "s| #.*$||g" \ - -e "s|#.*$||g" \ - -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ - -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | - awk -F$fs '{ + -e "s| #.*$||g" \ + -e "s|#.*$||g" \ + -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; for (i in vname) {if (i > indent) {delete vname[i]}} @@ -80,7 +80,7 @@ function parse_yaml { vn=""; for (i=0; i/etc/resolv.conf - chmod 644 /etc/resolv.conf - bashio::log.info "DNS SERVERS set to $DNSLIST" + # Write resolv.conf + # shellcheck disable=SC2059 + printf "${DNS}" >/etc/resolv.conf + chmod 644 /etc/resolv.conf + bashio::log.info "DNS SERVERS set to $DNSLIST" else - bashio::log.info "DNS Servers option empty. Using default router (or HA) dns servers." + bashio::log.info "DNS Servers option empty. Using default router (or HA) dns servers." fi diff --git a/.templates/92-local_mounts.sh b/.templates/92-local_mounts.sh index 38a706a96..b492e7587 100644 --- a/.templates/92-local_mounts.sh +++ b/.templates/92-local_mounts.sh @@ -8,29 +8,29 @@ # Mount local Share if configured if bashio::config.has_value 'localdisks'; then - MOREDISKS=$(bashio::config 'localdisks') - echo "Local Disks mounting..." + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." - # Separate comma separated values - # shellcheck disable=SC2086 - for disk in ${MOREDISKS//,/ }; do + # Separate comma separated values + # shellcheck disable=SC2086 + for disk in ${MOREDISKS//,/ }; do - # Mount by device as default - devpath=/dev + # Mount by device as default + devpath=/dev - # Mount as label - [ "${disk:0:2}" != "sd" ] && devpath=/dev/disk/by-label + # Mount as label + [ "${disk:0:2}" != "sd" ] && devpath=/dev/disk/by-label - # Creates dir - mkdir -p /mnt/"$disk" - chown -R "$(id -u)":"$(id -g)" /mnt/"$disk" - # Legacy mounting : mount to share if still exists (avoid breaking changes) - # shellcheck disable=SC2015 - [ -d /share/"$disk" ] && mount "$devpath"/"$disk" /share/"$disk" || true - # Mount - # shellcheck disable=SC2015 - mount "$devpath"/"$disk" /mnt/"$disk" && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + # Creates dir + mkdir -p /mnt/"$disk" + chown -R "$(id -u)":"$(id -g)" /mnt/"$disk" + # Legacy mounting : mount to share if still exists (avoid breaking changes) + # shellcheck disable=SC2015 + [ -d /share/"$disk" ] && mount "$devpath"/"$disk" /share/"$disk" || true + # Mount + # shellcheck disable=SC2015 + mount "$devpath"/"$disk" /mnt/"$disk" && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) - done + done fi diff --git a/.templates/92-smb_mounts.sh b/.templates/92-smb_mounts.sh index 1049737e2..d3b8f5546 100644 --- a/.templates/92-smb_mounts.sh +++ b/.templates/92-smb_mounts.sh @@ -7,83 +7,83 @@ ######################### if bashio::config.has_value 'networkdisks'; then - # Define variables - MOREDISKS=$(bashio::config 'networkdisks') - CIFS_USERNAME=$(bashio::config 'cifsusername') - CIFS_PASSWORD=$(bashio::config 'cifspassword') - MOUNTED=false - SMBVERS="" - SECVERS="" + # Define variables + MOREDISKS=$(bashio::config 'networkdisks') + CIFS_USERNAME=$(bashio::config 'cifsusername') + CIFS_PASSWORD=$(bashio::config 'cifspassword') + MOUNTED=false + SMBVERS="" + SECVERS="" - # Mount CIFS Share if configured and if Protection Mode is active - echo 'Mounting smb share(s)...' - - if bashio::config.has_value 'cifsdomain'; then - DOMAIN=",domain=$(bashio::config 'cifsdomain')" - else - DOMAIN="" - fi - - # Mounting disks - # shellcheck disable=SC2086 - for disk in ${MOREDISKS//,/ }; do # Separate comma separated values - - # Clean name of network share - # shellcheck disable=SC2116,SC2001 - disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name - diskname="${disk//\\//}" #replace \ with / - diskname="${diskname##*/}" # Get only last part of the name - - # Data validation - if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then - bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." - exit 0 - fi - - # Prepare mount point - mkdir -p /mnt/"$diskname" - chown -R root:root /mnt/"$diskname" - - # Tries to mount with default options - # shellcheck disable=SC2140 - mount -t cifs -o rw,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}$DOMAIN" "$disk" /mnt/"$diskname" 2>ERRORCODE && MOUNTED=true || MOUNTED=false - - # if Fail test different smb and sec versions - if [ "$MOUNTED" = false ]; then - for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN:-WORKGROUP}"; do - mount -t cifs -o "rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS" "$disk" /mnt/"$diskname" 2>/dev/null && MOUNTED=true && break || MOUNTED=false - for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5" ",iocharset=utf8"; do - mount -t cifs -o "rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS" "$disk" /mnt/"$disk" name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false - done - done - fi - - # Messages - if [ "$MOUNTED" = true ] && mountpoint -q /mnt/"$diskname"; then - #Test write permissions - # shellcheck disable=SC2015 - touch "/mnt/$diskname/testaze" && rm "/mnt/$diskname/testaze" && - bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || - bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw" + # Mount CIFS Share if configured and if Protection Mode is active + echo 'Mounting smb share(s)...' + if bashio::config.has_value 'cifsdomain'; then + DOMAIN=",domain=$(bashio::config 'cifsdomain')" else - # Mounting failed messages - bashio::log.fatal "Error, unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" - bashio::log.fatal "Here is some debugging info :" - - # Provide debugging info - smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client - #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true - smbclient -L $disk -U "$CIFS_USERNAME%$CIFS_PASSWORD" || true - - # Error code - bashio::log.fatal "Error read : $(/dev/null || true - rmdir "/mnt/$diskname" || true + DOMAIN="" fi - done + # Mounting disks + # shellcheck disable=SC2086 + for disk in ${MOREDISKS//,/ }; do # Separate comma separated values + + # Clean name of network share + # shellcheck disable=SC2116,SC2001 + disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name + diskname="${disk//\\//}" #replace \ with / + diskname="${diskname##*/}" # Get only last part of the name + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # Prepare mount point + mkdir -p /mnt/"$diskname" + chown -R root:root /mnt/"$diskname" + + # Tries to mount with default options + # shellcheck disable=SC2140 + mount -t cifs -o rw,username="$CIFS_USERNAME",password="${CIFS_PASSWORD}$DOMAIN" "$disk" /mnt/"$diskname" 2>ERRORCODE && MOUNTED=true || MOUNTED=false + + # if Fail test different smb and sec versions + if [ "$MOUNTED" = false ]; then + for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN:-WORKGROUP}"; do + mount -t cifs -o "rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS" "$disk" /mnt/"$diskname" 2>/dev/null && MOUNTED=true && break || MOUNTED=false + for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5" ",iocharset=utf8"; do + mount -t cifs -o "rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS" "$disk" /mnt/"$disk" name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false + done + done + fi + + # Messages + if [ "$MOUNTED" = true ] && mountpoint -q /mnt/"$diskname"; then + #Test write permissions + # shellcheck disable=SC2015 + touch "/mnt/$diskname/testaze" && rm "/mnt/$diskname/testaze" && + bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || + bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw" + + else + # Mounting failed messages + bashio::log.fatal "Error, unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U "$CIFS_USERNAME%$CIFS_PASSWORD" || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir "/mnt/$diskname" || true + fi + + done fi diff --git a/.templates/99-custom_script.sh b/.templates/99-custom_script.sh index 9351f1366..0b04f4017 100644 --- a/.templates/99-custom_script.sh +++ b/.templates/99-custom_script.sh @@ -4,5 +4,5 @@ CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION") CONFIGSOURCE="$(dirname "${CONFIGSOURCE}")" if [ -f "$CONFIGSOURCE"/script.sh ]; then -"$CONFIGSOURCE"./script.sh + "$CONFIGSOURCE"./script.sh fi diff --git a/.templates/automatic_packages.sh b/.templates/automatic_packages.sh index 14ac14fba..ff506c233 100644 --- a/.templates/automatic_packages.sh +++ b/.templates/automatic_packages.sh @@ -149,7 +149,7 @@ for packagestoinstall in $PACKAGES; do [ "$VERBOSE" = true ] && echo "... $packagestoinstall" if [ "$PACKMANAGER" = "apk" ]; then apk add --no-cache "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR) - elif [ "$PACKMANAGER" = "apt" ]; then + elif [ "$PACKMANAGER" = "apt" ]; then apt-get install -yqq --no-install-recommends "$packagestoinstall" &>/dev/null || (echo "Error : $packagestoinstall not found" && touch /ERROR) fi [ "$VERBOSE" = true ] && echo "... $packagestoinstall done" diff --git a/addons_updater/rootfs/entrypoint.sh b/addons_updater/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/addons_updater/rootfs/entrypoint.sh +++ b/addons_updater/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/addons_updater/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/addons_updater/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/addons_updater/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/addons_updater/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/addons_updater/rootfs/etc/cont-init.d/99-run.sh b/addons_updater/rootfs/etc/cont-init.d/99-run.sh index 7e2d93d8f..768af6511 100644 --- a/addons_updater/rootfs/etc/cont-init.d/99-run.sh +++ b/addons_updater/rootfs/etc/cont-init.d/99-run.sh @@ -23,156 +23,156 @@ git config --system user.password "${GITPASS}" git config --system user.email "${GITMAIL}" if bashio::config.has_value 'gitapi'; then - LOGINFO="... setting github API" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - GITHUB_API_TOKEN=$(bashio::config 'gitapi') - export GITHUB_API_TOKEN + LOGINFO="... setting github API" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + GITHUB_API_TOKEN=$(bashio::config 'gitapi') + export GITHUB_API_TOKEN fi LOGINFO="... parse addons" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi for addons in $(bashio::config "addon|keys"); do - SLUG=$(bashio::config "addon[${addons}].slug") - REPOSITORY=$(bashio::config "addon[${addons}].repository") - UPSTREAM=$(bashio::config "addon[${addons}].upstream") - BETA=$(bashio::config "addon[${addons}].beta") - FULLTAG=$(bashio::config "addon[${addons}].fulltag") - HAVINGASSET=$(bashio::config "addon[${addons}].having_asset") - SOURCE=$(bashio::config "addon[${addons}].source") - FILTER_TEXT=$(bashio::config "addon[${addons}].filter") - BASENAME=$(basename "https://github.com/$REPOSITORY") - DATE="$(date '+%d-%m-%Y')" + SLUG=$(bashio::config "addon[${addons}].slug") + REPOSITORY=$(bashio::config "addon[${addons}].repository") + UPSTREAM=$(bashio::config "addon[${addons}].upstream") + BETA=$(bashio::config "addon[${addons}].beta") + FULLTAG=$(bashio::config "addon[${addons}].fulltag") + HAVINGASSET=$(bashio::config "addon[${addons}].having_asset") + SOURCE=$(bashio::config "addon[${addons}].source") + FILTER_TEXT=$(bashio::config "addon[${addons}].filter") + BASENAME=$(basename "https://github.com/$REPOSITORY") + DATE="$(date '+%d-%m-%Y')" - #Create or update local version - if [ ! -d "/data/$BASENAME" ]; then - LOGINFO="... $SLUG : cloning ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - cd /data/ || exit - git clone "https://github.com/${REPOSITORY}" - else - LOGINFO="... $SLUG : updating ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - cd "/data/$BASENAME" || exit - git pull --rebase &>/dev/null || git reset --hard &>/dev/null - git pull --rebase &>/dev/null - fi - - #Define the folder addon - LOGINFO="... $SLUG : checking slug exists in repo" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - cd /data/"${BASENAME}"/"${SLUG}" || bashio::log.error "$SLUG addon not found in this repository. Exiting. Exiting." - - #Find current version - LOGINFO="... $SLUG : get current version" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - CURRENT=$(jq .upstream config.json) || bashio::log.error "$SLUG addon upstream tag not found in config.json. Exiting." - - if [ "$SOURCE" = "dockerhub" ]; then - # Use dockerhub as upstream - # shellcheck disable=SC2116 - DOCKERHUB_REPO=$(echo "${UPSTREAM%%/*}") - DOCKERHUB_IMAGE=$(echo "$UPSTREAM" | cut -d "/" -f2) - LASTVERSION=$( - curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=10" | - jq '.results | .[] | .name' -r | - sed -e '/.*latest.*/d' | - sed -e '/.*dev.*/d' | - sort -V | - tail -n 1 - ) - [ "${BETA}" = true ] && - LASTVERSION=$( - curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=10" | - jq '.results | .[] | .name' -r | - sed -e '/.*latest.*/d' | - sed -e '/.*dev.*/!d' | - sort -V | - tail -n 1 - ) - - else - # Use github as upstream - ARGUMENTS="" - #Prepare tag flag - if [ "${FULLTAG}" = true ]; then - LOGINFO="... $SLUG : fulltag is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - ARGUMENTS="$ARGUMENTS --format tag" + #Create or update local version + if [ ! -d "/data/$BASENAME" ]; then + LOGINFO="... $SLUG : cloning ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + cd /data/ || exit + git clone "https://github.com/${REPOSITORY}" else - LOGINFO="... $SLUG : fulltag is off" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + LOGINFO="... $SLUG : updating ${REPOSITORY}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + cd "/data/$BASENAME" || exit + git pull --rebase &>/dev/null || git reset --hard &>/dev/null + git pull --rebase &>/dev/null fi - #Prepare tag flag - if [ "${HAVINGASSET}" = true ]; then - LOGINFO="... $SLUG : asset_only tag is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - ARGUMENTS="$ARGUMENTS --having-asset" + #Define the folder addon + LOGINFO="... $SLUG : checking slug exists in repo" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + cd /data/"${BASENAME}"/"${SLUG}" || bashio::log.error "$SLUG addon not found in this repository. Exiting. Exiting." + + #Find current version + LOGINFO="... $SLUG : get current version" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + CURRENT=$(jq .upstream config.json) || bashio::log.error "$SLUG addon upstream tag not found in config.json. Exiting." + + if [ "$SOURCE" = "dockerhub" ]; then + # Use dockerhub as upstream + # shellcheck disable=SC2116 + DOCKERHUB_REPO=$(echo "${UPSTREAM%%/*}") + DOCKERHUB_IMAGE=$(echo "$UPSTREAM" | cut -d "/" -f2) + LASTVERSION=$( + curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=10" | + jq '.results | .[] | .name' -r | + sed -e '/.*latest.*/d' | + sed -e '/.*dev.*/d' | + sort -V | + tail -n 1 + ) + [ "${BETA}" = true ] && + LASTVERSION=$( + curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=10" | + jq '.results | .[] | .name' -r | + sed -e '/.*latest.*/d' | + sed -e '/.*dev.*/!d' | + sort -V | + tail -n 1 + ) + else - LOGINFO="... $SLUG : asset_only is off" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + # Use github as upstream + ARGUMENTS="" + #Prepare tag flag + if [ "${FULLTAG}" = true ]; then + LOGINFO="... $SLUG : fulltag is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + ARGUMENTS="$ARGUMENTS --format tag" + else + LOGINFO="... $SLUG : fulltag is off" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + fi + + #Prepare tag flag + if [ "${HAVINGASSET}" = true ]; then + LOGINFO="... $SLUG : asset_only tag is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + ARGUMENTS="$ARGUMENTS --having-asset" + else + LOGINFO="... $SLUG : asset_only is off" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + fi + + #Prepare tag flag + if [ "${FILTER_TEXT}" = "null" ] || [ "${FILTER_TEXT}" = "" ]; then + FILTER_TEXT="" + else + LOGINFO="... $SLUG : filter_text is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + ARGUMENTS="$ARGUMENTS --only $FILTER_TEXT" + fi + + #If beta flag, select beta version + if [ "${BETA}" = true ]; then + LOGINFO="... $SLUG : beta is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + # shellcheck disable=SC2086 + LASTVERSION=$(lastversion --pre "https://github.com/$UPSTREAM" $ARGUMENTS) || break + else + LOGINFO="... $SLUG : beta is off" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + # shellcheck disable=SC2086 + LASTVERSION=$(lastversion "https://github.com/$UPSTREAM" $ARGUMENTS) || break + fi + fi - #Prepare tag flag - if [ "${FILTER_TEXT}" = "null" ] || [ "${FILTER_TEXT}" = "" ]; then - FILTER_TEXT="" + # Add brackets + LASTVERSION='"'${LASTVERSION}'"' + + # Do not compare with ls tag for linuxserver images (to avoid updating only for dependencies) + #LASTVERSION2=${LASTVERSION%-ls*} + #CURRENT2=${CURRENT%-ls*} + LASTVERSION2=${LASTVERSION} + CURRENT2=${CURRENT} + + # Update if needed + if [ "${CURRENT2}" != "${LASTVERSION2}" ]; then + LOGINFO="... $SLUG : update from ${CURRENT} to ${LASTVERSION}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + + #Change all instances of version + LOGINFO="... $SLUG : updating files" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + for files in "config.json" "config.yaml" "Dockerfile" "build.json" "build.yaml";do + if [ -f /data/"${BASENAME}"/"${SLUG}"/$files ]; then + sed -i "s/${CURRENT}/${LASTVERSION}/g" /data/"${BASENAME}"/"${SLUG}"/"$files" + fi + done + + # Remove " and modify version + LASTVERSION=${LASTVERSION//\"/} + CURRENT=${CURRENT//\"/} + jq --arg variable "$LASTVERSION" '.version = $variable' /data/"${BASENAME}"/"${SLUG}"/config.json | sponge /data/"${BASENAME}"/"${SLUG}"/config.json # Replace version tag + + #Update changelog + touch "/data/${BASENAME}/${SLUG}/CHANGELOG.md" + sed -i "1i - Update to latest version from $UPSTREAM" "/data/${BASENAME}/${SLUG}/CHANGELOG.md" + sed -i "1i ## ${LASTVERSION} (${DATE})" "/data/${BASENAME}/${SLUG}/CHANGELOG.md" + sed -i "1i " "/data/${BASENAME}/${SLUG}/CHANGELOG.md" + LOGINFO="... $SLUG : files updated" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + + #Git commit and push + git add -A # add all modified files + git commit -m "Updater bot : $SLUG updated to ${LASTVERSION}" >/dev/null + + LOGINFO="... $SLUG : push to github" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi + git remote set-url origin "https://${GITUSER}:${GITPASS}@github.com/${REPOSITORY}" &>/dev/null + git push &>/dev/null + + #Log + bashio::log.yellow "... $SLUG updated from ${CURRENT} to ${LASTVERSION}" + else - LOGINFO="... $SLUG : filter_text is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - ARGUMENTS="$ARGUMENTS --only $FILTER_TEXT" + bashio::log.green "... $SLUG is up-to-date ${CURRENT}" fi - #If beta flag, select beta version - if [ "${BETA}" = true ]; then - LOGINFO="... $SLUG : beta is on" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - # shellcheck disable=SC2086 - LASTVERSION=$(lastversion --pre "https://github.com/$UPSTREAM" $ARGUMENTS) || break - else - LOGINFO="... $SLUG : beta is off" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - # shellcheck disable=SC2086 - LASTVERSION=$(lastversion "https://github.com/$UPSTREAM" $ARGUMENTS) || break - fi - - fi - - # Add brackets - LASTVERSION='"'${LASTVERSION}'"' - - # Do not compare with ls tag for linuxserver images (to avoid updating only for dependencies) - #LASTVERSION2=${LASTVERSION%-ls*} - #CURRENT2=${CURRENT%-ls*} - LASTVERSION2=${LASTVERSION} - CURRENT2=${CURRENT} - - # Update if needed - if [ "${CURRENT2}" != "${LASTVERSION2}" ]; then - LOGINFO="... $SLUG : update from ${CURRENT} to ${LASTVERSION}" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - - #Change all instances of version - LOGINFO="... $SLUG : updating files" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - for files in "config.json" "config.yaml" "Dockerfile" "build.json" "build.yaml";do - if [ -f /data/"${BASENAME}"/"${SLUG}"/$files ]; then - sed -i "s/${CURRENT}/${LASTVERSION}/g" /data/"${BASENAME}"/"${SLUG}"/"$files" - fi - done - - # Remove " and modify version - LASTVERSION=${LASTVERSION//\"/} - CURRENT=${CURRENT//\"/} - jq --arg variable "$LASTVERSION" '.version = $variable' /data/"${BASENAME}"/"${SLUG}"/config.json | sponge /data/"${BASENAME}"/"${SLUG}"/config.json # Replace version tag - - #Update changelog - touch "/data/${BASENAME}/${SLUG}/CHANGELOG.md" - sed -i "1i - Update to latest version from $UPSTREAM" "/data/${BASENAME}/${SLUG}/CHANGELOG.md" - sed -i "1i ## ${LASTVERSION} (${DATE})" "/data/${BASENAME}/${SLUG}/CHANGELOG.md" - sed -i "1i " "/data/${BASENAME}/${SLUG}/CHANGELOG.md" - LOGINFO="... $SLUG : files updated" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - - #Git commit and push - git add -A # add all modified files - git commit -m "Updater bot : $SLUG updated to ${LASTVERSION}" >/dev/null - - LOGINFO="... $SLUG : push to github" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi - git remote set-url origin "https://${GITUSER}:${GITPASS}@github.com/${REPOSITORY}" &>/dev/null - git push &>/dev/null - - #Log - bashio::log.yellow "... $SLUG updated from ${CURRENT} to ${LASTVERSION}" - - else - bashio::log.green "... $SLUG is up-to-date ${CURRENT}" - fi - done bashio::log.info "Addons update completed" diff --git a/arpspoof/rootfs/entrypoint.sh b/arpspoof/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/arpspoof/rootfs/entrypoint.sh +++ b/arpspoof/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/arpspoof/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/arpspoof/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/arpspoof/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/arpspoof/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/bazarr/rootfs/etc/cont-init.d/20-folders.sh b/bazarr/rootfs/etc/cont-init.d/20-folders.sh index ac8d1c7a5..322c1fb2d 100644 --- a/bazarr/rootfs/etc/cont-init.d/20-folders.sh +++ b/bazarr/rootfs/etc/cont-init.d/20-folders.sh @@ -1,33 +1,33 @@ #!/bin/bash if [ ! -d /share/storage/movies ]; then - echo "Creating /share/storage/movies" - mkdir -p /share/storage/movies - chown -R abc:abc /share/storage/movies + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies fi if [ ! -d /share/storage/tv ]; then - echo "Creating /share/storage/tv" - mkdir -p /share/storage/tv - chown -R abc:abc /share/storage/tv + echo "Creating /share/storage/tv" + mkdir -p /share/storage/tv + chown -R abc:abc /share/storage/tv fi if [ ! -d /share/downloads ]; then - echo "Creating /share/downloads" - mkdir -p /share/downloads - chown -R abc:abc /share/downloads + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads fi if [ -d /config/bazarr ] && [ ! -d /config/addons_config/bazarr ]; then - echo "Moving to new location /config/addons_config/bazarr" - mkdir -p /config/addons_config/bazarr - chown -R abc:abc /config/addons_config/bazarr - mv /config/bazarr/* /config/addons_config/bazarr/ - rm -r /config/bazarr + echo "Moving to new location /config/addons_config/bazarr" + mkdir -p /config/addons_config/bazarr + chown -R abc:abc /config/addons_config/bazarr + mv /config/bazarr/* /config/addons_config/bazarr/ + rm -r /config/bazarr fi if [ ! -d /config/addons_config/bazarr ]; then - echo "Creating /config/addons_config/bazarr" - mkdir -p /config/addons_config/bazarr - chown -R abc:abc /config/addons_config/bazarr + echo "Creating /config/addons_config/bazarr" + mkdir -p /config/addons_config/bazarr + chown -R abc:abc /config/addons_config/bazarr fi diff --git a/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/cloudcommander/rootfs/entrypoint.sh b/cloudcommander/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/cloudcommander/rootfs/entrypoint.sh +++ b/cloudcommander/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/cloudcommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/cloudcommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/cloudcommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/cloudcommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/cloudcommander/rootfs/etc/cont-init.d/99-run.sh b/cloudcommander/rootfs/etc/cont-init.d/99-run.sh index cb12eaff0..0b0fee452 100644 --- a/cloudcommander/rootfs/etc/cont-init.d/99-run.sh +++ b/cloudcommander/rootfs/etc/cont-init.d/99-run.sh @@ -16,8 +16,8 @@ export CLOUDCMD_PREFIX declare ADDON_PROTOCOL=http if bashio::config.true 'ssl'; then - ADDON_PROTOCOL=https - bashio::config.require.ssl + ADDON_PROTOCOL=https + bashio::config.require.ssl fi # port=$(bashio::addon.port 80) @@ -34,15 +34,15 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log ############### if bashio::config.has_value 'CUSTOM_OPTIONS'; then - CUSTOMOPTIONS=" $(bashio::config 'CUSTOM_OPTIONS')" + CUSTOMOPTIONS=" $(bashio::config 'CUSTOM_OPTIONS')" else - CUSTOMOPTIONS="" + CUSTOMOPTIONS="" fi if bashio::config.has_value 'DROPBOX_TOKEN'; then - DROPBOX_TOKEN="--dropbox --dropbox-token $(bashio::config 'DROPBOX_TOKEN')" + DROPBOX_TOKEN="--dropbox --dropbox-token $(bashio::config 'DROPBOX_TOKEN')" else - DROPBOX_TOKEN="" + DROPBOX_TOKEN="" fi bashio::log.info "Starting..." diff --git a/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/emby/rootfs/etc/cont-init.d/20-folders.sh b/emby/rootfs/etc/cont-init.d/20-folders.sh index 17e59c0d6..e2f96a3f9 100644 --- a/emby/rootfs/etc/cont-init.d/20-folders.sh +++ b/emby/rootfs/etc/cont-init.d/20-folders.sh @@ -1,90 +1,90 @@ #!/bin/bash if [ ! -d /emby ]; then - echo "Creating /emby" - mkdir -p /emby - chown -R abc:abc /emby + echo "Creating /emby" + mkdir -p /emby + chown -R abc:abc /emby fi if [ ! -d /share/storage/tv ]; then - echo "Creating /share/storage/tv" - mkdir -p /share/storage/tv - chown -R abc:abc /share/storage/tv + echo "Creating /share/storage/tv" + mkdir -p /share/storage/tv + chown -R abc:abc /share/storage/tv fi if [ ! -d /share/storage/movies ]; then - echo "Creating /share/storage/movies" - mkdir -p /share/storage/movies - chown -R abc:abc /share/storage/movies + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies fi if [ ! -d /share/emby ]; then - echo "Creating /share/emby" - mkdir -p /share/emby - chown -R abc:abc /share/emby + echo "Creating /share/emby" + mkdir -p /share/emby + chown -R abc:abc /share/emby fi if [ -d /config/emby ] && [ ! -d /config/addons_config/emby ]; then - echo "Moving to new location /config/addons_config/emby" - mkdir -p /config/addons_config/emby - chown -R abc:abc /config/addons_config/emby - mv /config/emby/* /config/addons_config/emby/ - rm -r /config/emby + echo "Moving to new location /config/addons_config/emby" + mkdir -p /config/addons_config/emby + chown -R abc:abc /config/addons_config/emby + mv /config/emby/* /config/addons_config/emby/ + rm -r /config/emby fi if [ ! -d /config/addons_config/emby ]; then - echo "Creating /config/addons_config/emby" - mkdir -p /config/addons_config/emby - chown -R abc:abc /config/addons_config/emby + echo "Creating /config/addons_config/emby" + mkdir -p /config/addons_config/emby + chown -R abc:abc /config/addons_config/emby fi # links if [ ! -d /emby/cache ]; then - echo "Creating link for /emby/cache" - mkdir -p /share/emby/cache - chown -R abc:abc /share/emby/cache - ln -s /share/emby/cache /emby/cache + echo "Creating link for /emby/cache" + mkdir -p /share/emby/cache + chown -R abc:abc /share/emby/cache + ln -s /share/emby/cache /emby/cache fi if [ ! -d /emby/config ]; then - echo "Creating link for /emby/config" - mkdir -p /config/emby - chown -R abc:abc /config/emby - ln -s /config/emby /emby/config + echo "Creating link for /emby/config" + mkdir -p /config/emby + chown -R abc:abc /config/emby + ln -s /config/emby /emby/config fi if [ ! -d /emby/data ]; then - echo "Creating link for /emby/data" - mkdir -p /share/emby/data - chown -R abc:abc /share/emby/data - ln -s /share/emby/data /emby/data + echo "Creating link for /emby/data" + mkdir -p /share/emby/data + chown -R abc:abc /share/emby/data + ln -s /share/emby/data /emby/data fi if [ ! -d /emby/logs ]; then - echo "Creating link for /emby/logs" - mkdir -p /share/emby/logs - chown -R abc:abc /share/emby/logs - ln -s /share/emby/logs /emby/logs + echo "Creating link for /emby/logs" + mkdir -p /share/emby/logs + chown -R abc:abc /share/emby/logs + ln -s /share/emby/logs /emby/logs fi if [ ! -d /emby/metadata ]; then - echo "Creating link for /emby/metadata" - mkdir -p /share/emby/metadata - chown -R abc:abc /share/emby/metadata - ln -s /share/emby/metadata /emby/metadata + echo "Creating link for /emby/metadata" + mkdir -p /share/emby/metadata + chown -R abc:abc /share/emby/metadata + ln -s /share/emby/metadata /emby/metadata fi if [ ! -d /emby/plugins ]; then - echo "Creating link for /emby/plugins" - mkdir -p /share/emby/plugins - chown -R abc:abc /share/emby/plugins - ln -s /share/emby/plugins /emby/plugins + echo "Creating link for /emby/plugins" + mkdir -p /share/emby/plugins + chown -R abc:abc /share/emby/plugins + ln -s /share/emby/plugins /emby/plugins fi if [ ! -d /emby/root ]; then - echo "Creating link for /emby/root" - mkdir -p /share/emby/root - chown -R abc:abc /share/emby/root - ln -s /share/emby/root /emby/root + echo "Creating link for /emby/root" + mkdir -p /share/emby/root + chown -R abc:abc /share/emby/root + ln -s /share/emby/root /emby/root fi diff --git a/enedisgateway2mqtt/rootfs/entrypoint.sh b/enedisgateway2mqtt/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/enedisgateway2mqtt/rootfs/entrypoint.sh +++ b/enedisgateway2mqtt/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/enedisgateway2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/enedisgateway2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/enedisgateway2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/enedisgateway2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh index 52f832657..759976be4 100644 --- a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh @@ -15,33 +15,33 @@ mkdir -p "$(dirname "${DATABASESOURCE}")" # Check absence of config file if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then - bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" - mv /data/config.yaml "$CONFIGSOURCE".bak + bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" + mv /data/config.yaml "$CONFIGSOURCE".bak fi # Check if config file is there, or create one from template if [ -f "$CONFIGSOURCE" ]; then - # Create symlink if not existing yet - [ ! -L /data/config.yaml ] && ln -sf "$CONFIGSOURCE" /data - bashio::log.info "Using config file found in $CONFIGSOURCE" + # Create symlink if not existing yet + [ ! -L /data/config.yaml ] && ln -sf "$CONFIGSOURCE" /data + bashio::log.info "Using config file found in $CONFIGSOURCE" - # Check if yaml is valid - EXIT_CODE=0 - yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$? - if [ "$EXIT_CODE" = 0 ]; then - echo "Config file is a valid yaml" - else - cat ERROR - bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" - bashio::exit.nok - fi + # Check if yaml is valid + EXIT_CODE=0 + yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$? + if [ "$EXIT_CODE" = 0 ]; then + echo "Config file is a valid yaml" + else + cat ERROR + bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" + bashio::exit.nok + fi else - # Create symlink for addon to create config - touch "${CONFIGSOURCE}" - ln -sf "$CONFIGSOURCE" /data - rm "$CONFIGSOURCE" - # Need to restart - bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." + # Create symlink for addon to create config + touch "${CONFIGSOURCE}" + ln -sf "$CONFIGSOURCE" /data + rm "$CONFIGSOURCE" + # Need to restart + bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." fi # Remove previous link or file @@ -49,14 +49,14 @@ fi # Check if database is here or create symlink if [ -f "$DATABASESOURCE" ]; then - # Create symlink if not existing yet - ln -sf "${DATABASESOURCE}" /data && echo "creating symlink" - bashio::log.info "Using database file found in $DATABASESOURCE" + # Create symlink if not existing yet + ln -sf "${DATABASESOURCE}" /data && echo "creating symlink" + bashio::log.info "Using database file found in $DATABASESOURCE" else - # Create symlink for addon to create database - touch "${DATABASESOURCE}" - ln -sf "$DATABASESOURCE" /data - rm "$DATABASESOURCE" + # Create symlink for addon to create database + touch "${DATABASESOURCE}" + ln -sf "$DATABASESOURCE" /data + rm "$DATABASESOURCE" fi ############## @@ -69,10 +69,10 @@ echo " " # Test mode TZ=$(bashio::config "TZ") if [ "$TZ" = "test" ]; then - echo "secret mode found, launching script in /config/test.sh" - cd /config || exit - chmod 777 test.sh - ./test.sh + echo "secret mode found, launching script in /config/test.sh" + cd /config || exit + chmod 777 test.sh + ./test.sh fi python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?" diff --git a/enedisgateway2mqtt_dev/rootfs/entrypoint.sh b/enedisgateway2mqtt_dev/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/enedisgateway2mqtt_dev/rootfs/entrypoint.sh +++ b/enedisgateway2mqtt_dev/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh index 52f832657..759976be4 100644 --- a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh @@ -15,33 +15,33 @@ mkdir -p "$(dirname "${DATABASESOURCE}")" # Check absence of config file if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then - bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" - mv /data/config.yaml "$CONFIGSOURCE".bak + bashio::log.warning "A current config was found in /data, it is backuped to ${CONFIGSOURCE}.bak" + mv /data/config.yaml "$CONFIGSOURCE".bak fi # Check if config file is there, or create one from template if [ -f "$CONFIGSOURCE" ]; then - # Create symlink if not existing yet - [ ! -L /data/config.yaml ] && ln -sf "$CONFIGSOURCE" /data - bashio::log.info "Using config file found in $CONFIGSOURCE" + # Create symlink if not existing yet + [ ! -L /data/config.yaml ] && ln -sf "$CONFIGSOURCE" /data + bashio::log.info "Using config file found in $CONFIGSOURCE" - # Check if yaml is valid - EXIT_CODE=0 - yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$? - if [ "$EXIT_CODE" = 0 ]; then - echo "Config file is a valid yaml" - else - cat ERROR - bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" - bashio::exit.nok - fi + # Check if yaml is valid + EXIT_CODE=0 + yamllint -d relaxed "$CONFIGSOURCE" &>ERROR || EXIT_CODE=$? + if [ "$EXIT_CODE" = 0 ]; then + echo "Config file is a valid yaml" + else + cat ERROR + bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above. You can check yaml validity with the online tool yamllint.com" + bashio::exit.nok + fi else - # Create symlink for addon to create config - touch "${CONFIGSOURCE}" - ln -sf "$CONFIGSOURCE" /data - rm "$CONFIGSOURCE" - # Need to restart - bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." + # Create symlink for addon to create config + touch "${CONFIGSOURCE}" + ln -sf "$CONFIGSOURCE" /data + rm "$CONFIGSOURCE" + # Need to restart + bashio::log.fatal "Config file not found. The addon will create a new one, then stop. Please customize the file in $CONFIGSOURCE before restarting." fi # Remove previous link or file @@ -49,14 +49,14 @@ fi # Check if database is here or create symlink if [ -f "$DATABASESOURCE" ]; then - # Create symlink if not existing yet - ln -sf "${DATABASESOURCE}" /data && echo "creating symlink" - bashio::log.info "Using database file found in $DATABASESOURCE" + # Create symlink if not existing yet + ln -sf "${DATABASESOURCE}" /data && echo "creating symlink" + bashio::log.info "Using database file found in $DATABASESOURCE" else - # Create symlink for addon to create database - touch "${DATABASESOURCE}" - ln -sf "$DATABASESOURCE" /data - rm "$DATABASESOURCE" + # Create symlink for addon to create database + touch "${DATABASESOURCE}" + ln -sf "$DATABASESOURCE" /data + rm "$DATABASESOURCE" fi ############## @@ -69,10 +69,10 @@ echo " " # Test mode TZ=$(bashio::config "TZ") if [ "$TZ" = "test" ]; then - echo "secret mode found, launching script in /config/test.sh" - cd /config || exit - chmod 777 test.sh - ./test.sh + echo "secret mode found, launching script in /config/test.sh" + cd /config || exit + chmod 777 test.sh + ./test.sh fi python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?" diff --git a/filebrowser/rootfs/entrypoint.sh b/filebrowser/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/filebrowser/rootfs/entrypoint.sh +++ b/filebrowser/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/filebrowser/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/filebrowser/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/filebrowser/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/filebrowser/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/filebrowser/rootfs/etc/cont-init.d/20-folders.sh b/filebrowser/rootfs/etc/cont-init.d/20-folders.sh index 3fb69187e..9bab0da74 100644 --- a/filebrowser/rootfs/etc/cont-init.d/20-folders.sh +++ b/filebrowser/rootfs/etc/cont-init.d/20-folders.sh @@ -2,15 +2,15 @@ # shellcheck shell=bash if [ -d /config/filebrowser ]; then - echo "Moving to new location /config/addons_config/filebrowser" - mkdir -p /config/addons_config/filebrowser - chmod 777 /config/addons_config/filebrowser - mv /config/filebrowser/* /config/addons_config/filebrowser/ - rm -r /config/filebrowser + echo "Moving to new location /config/addons_config/filebrowser" + mkdir -p /config/addons_config/filebrowser + chmod 777 /config/addons_config/filebrowser + mv /config/filebrowser/* /config/addons_config/filebrowser/ + rm -r /config/filebrowser fi if [ ! -d /config/addons_config/filebrowser ]; then - echo "Creating /config/addons_config/filebrowser" - mkdir -p /config/addons_config/filebrowser - chmod 777 /config/addons_config/filebrowser + echo "Creating /config/addons_config/filebrowser" + mkdir -p /config/addons_config/filebrowser + chmod 777 /config/addons_config/filebrowser fi diff --git a/filebrowser/rootfs/etc/cont-init.d/99-run.sh b/filebrowser/rootfs/etc/cont-init.d/99-run.sh index 8027e6a95..a67cc569f 100644 --- a/filebrowser/rootfs/etc/cont-init.d/99-run.sh +++ b/filebrowser/rootfs/etc/cont-init.d/99-run.sh @@ -7,13 +7,13 @@ bashio::config.require.ssl if bashio::config.true 'ssl'; then - bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" - #set variables - CERTFILE="-t /ssl/$(bashio::config 'certfile')" - KEYFILE="-k /ssl/$(bashio::config 'keyfile')" + bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" + #set variables + CERTFILE="-t /ssl/$(bashio::config 'certfile')" + KEYFILE="-k /ssl/$(bashio::config 'keyfile')" else - CERTFILE="" - KEYFILE="" + CERTFILE="" + KEYFILE="" fi ################# @@ -32,7 +32,7 @@ export FB_BASEURL declare ADDON_PROTOCOL=http # Generate Ingress configuration if bashio::config.true 'ssl'; then - ADDON_PROTOCOL=https + ADDON_PROTOCOL=https fi #port=$(bashio::addon.port 80) @@ -51,28 +51,28 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log NOAUTH="" if bashio::config.true 'NoAuth'; then - if ! bashio::fs.file_exists "/data/noauth"; then - rm /data/auth &>/dev/null || true - rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true - touch /data/noauth - NOAUTH="--noauth" - bashio::log.warning "Auth method change, database reset" - fi - bashio::log.info "NoAuth option selected" + if ! bashio::fs.file_exists "/data/noauth"; then + rm /data/auth &>/dev/null || true + rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true + touch /data/noauth + NOAUTH="--noauth" + bashio::log.warning "Auth method change, database reset" + fi + bashio::log.info "NoAuth option selected" else - if ! bashio::fs.file_exists "/data/auth"; then - rm /data/noauth &>/dev/null || true - rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true - touch /data/auth - bashio::log.warning "Auth method change, database reset" - fi - bashio::log.info "Default username/password : admin/admin" + if ! bashio::fs.file_exists "/data/auth"; then + rm /data/noauth &>/dev/null || true + rm /config/addons_config/filebrowser/filebrowser.dB &>/dev/null || true + touch /data/auth + bashio::log.warning "Auth method change, database reset" + fi + bashio::log.info "Default username/password : admin/admin" fi if bashio::config.has_value 'base_folder'; then - BASE_FOLDER=$(bashio::config 'base_folder') + BASE_FOLDER=$(bashio::config 'base_folder') else - BASE_FOLDER=/ + BASE_FOLDER=/ fi bashio::log.info "Starting..." diff --git a/fireflyiii/rootfs/entrypoint.sh b/fireflyiii/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/fireflyiii/rootfs/entrypoint.sh +++ b/fireflyiii/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/fireflyiii/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/fireflyiii/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/fireflyiii/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/fireflyiii/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/fireflyiii/rootfs/etc/cont-init.d/99-run.sh b/fireflyiii/rootfs/etc/cont-init.d/99-run.sh index 2e2d4a40e..18e13cfcc 100644 --- a/fireflyiii/rootfs/etc/cont-init.d/99-run.sh +++ b/fireflyiii/rootfs/etc/cont-init.d/99-run.sh @@ -11,8 +11,8 @@ APP_KEY="$(bashio::config 'APP_KEY')" # If not base64 if [[ ! "$APP_KEY" == *"base64"* ]]; then - # Check APP_KEY format - if [ ! "${#APP_KEY}" = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} instead of 32 characters"; fi + # Check APP_KEY format + if [ ! "${#APP_KEY}" = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} instead of 32 characters"; fi fi # Backup APP_KEY file @@ -42,82 +42,82 @@ chmod -R 775 /config/addons_config/fireflyiii bashio::log.info "Defining database" case $(bashio::config 'DB_CONNECTION') in -# Use sqlite -sqlite_internal) - bashio::log.info "Using built in sqlite" + # Use sqlite + sqlite_internal) + bashio::log.info "Using built in sqlite" - # Set variable - export DB_CONNECTION=sqlite + # Set variable + export DB_CONNECTION=sqlite - # Creating folders - mkdir -p /config/addons_config/fireflyiii/database - chown -R www-data:www-data /config/addons_config/fireflyiii/database + # Creating folders + mkdir -p /config/addons_config/fireflyiii/database + chown -R www-data:www-data /config/addons_config/fireflyiii/database - # Creating database - if [ ! -f /config/addons_config/fireflyiii/database/database.sqlite ]; then - # Create database - touch /config/addons_config/fireflyiii/database/database.sqlite - # Install database - echo "updating database" - php artisan migrate:refresh --seed --quiet - php artisan firefly-iii:upgrade-database --quiet - php artisan passport:install --quiet - fi - - # Creating symlink - rm -r /var/www/html/storage/database - ln -s /config/addons_config/fireflyiii/database /var/www/html/storage/database - - # Updating permissions - chmod 775 /config/addons_config/fireflyiii/database/database.sqlite - chown -R www-data:www-data /config/addons_config/fireflyiii - chown -R www-data:www-data /var/www/html/storage - ;; - -# Use MariaDB -mariadb_addon) - bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." - if ! bashio::services.available 'mysql'; then - bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" - bashio::exit.nok \ - "Please ensure it is installed and started" - fi - - # Use values - DB_CONNECTION=mysql - DB_HOST=$(bashio::services "mysql" "host") - DB_PORT=$(bashio::services "mysql" "port") - DB_DATABASE=firefly - DB_USERNAME=$(bashio::services "mysql" "username") - DB_PASSWORD=$(bashio::services "mysql" "password") - export DB_CONNECTION - export DB_HOST && bashio::log.blue "DB_HOST=$DB_HOST" - export DB_PORT && bashio::log.blue "DB_PORT=$DB_PORT" - export DB_DATABASE && bashio::log.blue "DB_DATABASE=$DB_DATABASE" - export DB_USERNAME && bashio::log.blue "DB_USERNAME=$DB_USERNAME" - export DB_PASSWORD && bashio::log.blue "DB_PASSWORD=$DB_PASSWORD" - - bashio::log.warning "Firefly-iii is using the Maria DB addon" - bashio::log.warning "Please ensure this is included in your backups" - bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - - bashio::log.info "Creating database for Firefly-iii if required" - mysql \ - -u "${DB_USERNAME}" -p"${DB_PASSWORD}" \ - -h "${DB_HOST}" -P "${DB_PORT}" \ - -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" - ;; - -# Use remote -*) - bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" - for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do - if ! bashio::config.has_value "$conditions"; then - bashio::exit.nok "Remote database has been specified but $conditions is not defined in addon options" + # Creating database + if [ ! -f /config/addons_config/fireflyiii/database/database.sqlite ]; then + # Create database + touch /config/addons_config/fireflyiii/database/database.sqlite + # Install database + echo "updating database" + php artisan migrate:refresh --seed --quiet + php artisan firefly-iii:upgrade-database --quiet + php artisan passport:install --quiet fi - done - ;; + + # Creating symlink + rm -r /var/www/html/storage/database + ln -s /config/addons_config/fireflyiii/database /var/www/html/storage/database + + # Updating permissions + chmod 775 /config/addons_config/fireflyiii/database/database.sqlite + chown -R www-data:www-data /config/addons_config/fireflyiii + chown -R www-data:www-data /var/www/html/storage + ;; + + # Use MariaDB + mariadb_addon) + bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." + if ! bashio::services.available 'mysql'; then + bashio::log.fatal \ + "Local database access should be provided by the MariaDB addon" + bashio::exit.nok \ + "Please ensure it is installed and started" + fi + + # Use values + DB_CONNECTION=mysql + DB_HOST=$(bashio::services "mysql" "host") + DB_PORT=$(bashio::services "mysql" "port") + DB_DATABASE=firefly + DB_USERNAME=$(bashio::services "mysql" "username") + DB_PASSWORD=$(bashio::services "mysql" "password") + export DB_CONNECTION + export DB_HOST && bashio::log.blue "DB_HOST=$DB_HOST" + export DB_PORT && bashio::log.blue "DB_PORT=$DB_PORT" + export DB_DATABASE && bashio::log.blue "DB_DATABASE=$DB_DATABASE" + export DB_USERNAME && bashio::log.blue "DB_USERNAME=$DB_USERNAME" + export DB_PASSWORD && bashio::log.blue "DB_PASSWORD=$DB_PASSWORD" + + bashio::log.warning "Firefly-iii is using the Maria DB addon" + bashio::log.warning "Please ensure this is included in your backups" + bashio::log.warning "Uninstalling the MariaDB addon will remove any data" + + bashio::log.info "Creating database for Firefly-iii if required" + mysql \ + -u "${DB_USERNAME}" -p"${DB_PASSWORD}" \ + -h "${DB_HOST}" -P "${DB_PORT}" \ + -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" + ;; + + # Use remote + *) + bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" + for conditions in "DB_HOST" "DB_PORT" "DB_DATABASE" "DB_USERNAME" "DB_PASSWORD"; do + if ! bashio::config.has_value "$conditions"; then + bashio::exit.nok "Remote database has been specified but $conditions is not defined in addon options" + fi + done + ;; esac diff --git a/fireflyiii_data_importer/rootfs/entrypoint.sh b/fireflyiii_data_importer/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/fireflyiii_data_importer/rootfs/entrypoint.sh +++ b/fireflyiii_data_importer/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/fireflyiii_data_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/fireflyiii_data_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/fireflyiii_data_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/fireflyiii_data_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/fireflyiii_fints_importer/rootfs/entrypoint.sh b/fireflyiii_fints_importer/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/fireflyiii_fints_importer/rootfs/entrypoint.sh +++ b/fireflyiii_fints_importer/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/fireflyiii_fints_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/fireflyiii_fints_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/fireflyiii_fints_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/fireflyiii_fints_importer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/flaresolverr/rootfs/entrypoint.sh b/flaresolverr/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/flaresolverr/rootfs/entrypoint.sh +++ b/flaresolverr/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/flaresolverr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/flaresolverr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/flaresolverr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/flaresolverr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/gazpar2mqtt/rootfs/entrypoint.sh b/gazpar2mqtt/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/gazpar2mqtt/rootfs/entrypoint.sh +++ b/gazpar2mqtt/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/gazpar2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/gazpar2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 514fe0789..0e6be74fb 100644 --- a/gazpar2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/gazpar2mqtt/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,11 +11,11 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" \ - && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] \ - && echo "setting permission" && chmod 755 /etc/cont-init.d/"$scripts" || (echo "script failed to install $scripts" && exit 1); done + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" \ + && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] \ + && echo "setting permission" && chmod 755 /etc/cont-init.d/"$scripts" || (echo "script failed to install $scripts" && exit 1); done fi @@ -27,9 +27,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/grav/rootfs/etc/cont-init.d/20-folders.sh b/grav/rootfs/etc/cont-init.d/20-folders.sh index 63d054585..008f964bf 100644 --- a/grav/rootfs/etc/cont-init.d/20-folders.sh +++ b/grav/rootfs/etc/cont-init.d/20-folders.sh @@ -4,9 +4,9 @@ echo "Updating folders..." for FOLDERS in "/share/grav" "/app/grav-admin/backup"; do - echo "... $FOLDERS" - mkdir -p $FOLDERS - chown -R abc:abc $FOLDERS + echo "... $FOLDERS" + mkdir -p $FOLDERS + chown -R abc:abc $FOLDERS done bashio::log.warning "If error of missing folder when loading addon, just restart" diff --git a/inadyn/rootfs/entrypoint.sh b/inadyn/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/inadyn/rootfs/entrypoint.sh +++ b/inadyn/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/inadyn/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/inadyn/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/inadyn/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/inadyn/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/jackett/rootfs/etc/cont-init.d/20-folders.sh b/jackett/rootfs/etc/cont-init.d/20-folders.sh index f4d27377c..f1ca4f470 100644 --- a/jackett/rootfs/etc/cont-init.d/20-folders.sh +++ b/jackett/rootfs/etc/cont-init.d/20-folders.sh @@ -1,22 +1,22 @@ #!/bin/bash if [ ! -d /share/downloads ]; then - echo "Creating /share/downloads" - mkdir -p /share/downloads - chown -R abc:abc /share/downloads + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads fi if [ -d /config/Jackett ] && [ ! -d /config/addons_config/Jackett ]; then - echo "Moving to new location /config/addons_config/Jackett" - mkdir -p /config/addons_config/Jackett - chown -R abc:abc /config/addons_config/Jackett - mv /config/Jackett/* /config/addons_config/Jackett/ - rm -r /config/Jackett - rm -r /config/jackett + echo "Moving to new location /config/addons_config/Jackett" + mkdir -p /config/addons_config/Jackett + chown -R abc:abc /config/addons_config/Jackett + mv /config/Jackett/* /config/addons_config/Jackett/ + rm -r /config/Jackett + rm -r /config/jackett fi if [ ! -d /config/addons_config/Jackett ]; then - echo "Creating /config/addons_config/Jackett" - mkdir -p /config/addons_config/Jackett - chown -R abc:abc /config/addons_config/Jackett + echo "Creating /config/addons_config/Jackett" + mkdir -p /config/addons_config/Jackett + chown -R abc:abc /config/addons_config/Jackett fi diff --git a/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/jellyfin/rootfs/etc/cont-init.d/20-folders.sh b/jellyfin/rootfs/etc/cont-init.d/20-folders.sh index a61296c99..746ca2926 100644 --- a/jellyfin/rootfs/etc/cont-init.d/20-folders.sh +++ b/jellyfin/rootfs/etc/cont-init.d/20-folders.sh @@ -3,10 +3,10 @@ LOCATION=$(bashio::config 'data_location') -# Check if config is located in an acceptable location +# Check if config is located in an acceptable location LOCATIONOK="" for location in "/share" "/config" "/data" "/mnt"; do - if [[ "$LOCATION" == "$location"* ]]; then + if [[ "$LOCATION" == "$location"* ]]; then LOCATIONOK=true fi done @@ -19,69 +19,69 @@ fi # Set folders if [ ! -d /jellyfin ]; then - echo "Creating /jellyfin" - mkdir -p /jellyfin - chown -R abc:abc /jellyfin + echo "Creating /jellyfin" + mkdir -p /jellyfin + chown -R abc:abc /jellyfin fi if [ ! -d "$LOCATION"/tv ]; then - echo "Creating $LOCATION/tv" - mkdir -p "$LOCATION"/tv - chown -R abc:abc "$LOCATION"/tv + echo "Creating $LOCATION/tv" + mkdir -p "$LOCATION"/tv + chown -R abc:abc "$LOCATION"/tv fi if [ ! -d "$LOCATION"/movies ]; then - echo "Creating $LOCATION/movies" - mkdir -p "$LOCATION"/movies - chown -R abc:abc "$LOCATION"/movies + echo "Creating $LOCATION/movies" + mkdir -p "$LOCATION"/movies + chown -R abc:abc "$LOCATION"/movies fi if [ ! -d "$LOCATION" ]; then - echo "Creating $LOCATION" - mkdir -p "$LOCATION" - chown -R abc:abc "$LOCATION" + echo "Creating $LOCATION" + mkdir -p "$LOCATION" + chown -R abc:abc "$LOCATION" fi # links if [ ! -d /jellyfin/cache ]; then - echo "Creating link for /jellyfin/cache" - mkdir -p "$LOCATION"/cache - chown -R abc:abc "$LOCATION"/cache - ln -s "$LOCATION"/cache /jellyfin/cache + echo "Creating link for /jellyfin/cache" + mkdir -p "$LOCATION"/cache + chown -R abc:abc "$LOCATION"/cache + ln -s "$LOCATION"/cache /jellyfin/cache fi if [ ! -d /jellyfin/data ]; then - echo "Creating link for /jellyfin/data" - mkdir -p "$LOCATION"/data - chown -R abc:abc "$LOCATION"/data - ln -s "$LOCATION"/data /jellyfin/data + echo "Creating link for /jellyfin/data" + mkdir -p "$LOCATION"/data + chown -R abc:abc "$LOCATION"/data + ln -s "$LOCATION"/data /jellyfin/data fi if [ ! -d /jellyfin/logs ]; then - echo "Creating link for /jellyfin/logs" - mkdir -p "$LOCATION"/logs - chown -R abc:abc "$LOCATION"/logs - ln -s "$LOCATION"/logs /jellyfin/logs + echo "Creating link for /jellyfin/logs" + mkdir -p "$LOCATION"/logs + chown -R abc:abc "$LOCATION"/logs + ln -s "$LOCATION"/logs /jellyfin/logs fi if [ ! -d /jellyfin/metadata ]; then - echo "Creating link for /jellyfin/metadata" - mkdir -p "$LOCATION"/metadata - chown -R abc:abc "$LOCATION"/metadata - ln -s "$LOCATION"/metadata /jellyfin/metadata + echo "Creating link for /jellyfin/metadata" + mkdir -p "$LOCATION"/metadata + chown -R abc:abc "$LOCATION"/metadata + ln -s "$LOCATION"/metadata /jellyfin/metadata fi if [ ! -d /jellyfin/plugins ]; then - echo "Creating link for /jellyfin/plugins" - mkdir -p "$LOCATION"/plugins - chown -R abc:abc "$LOCATION"/plugins - ln -s "$LOCATION"/plugins /jellyfin/plugins + echo "Creating link for /jellyfin/plugins" + mkdir -p "$LOCATION"/plugins + chown -R abc:abc "$LOCATION"/plugins + ln -s "$LOCATION"/plugins /jellyfin/plugins fi if [ ! -d /jellyfin/root ]; then - echo "Creating link for /jellyfin/root" - mkdir -p "$LOCATION"/root - chown -R abc:abc "$LOCATION"/root - ln -s "$LOCATION"/root /jellyfin/root + echo "Creating link for /jellyfin/root" + mkdir -p "$LOCATION"/root + chown -R abc:abc "$LOCATION"/root + ln -s "$LOCATION"/root /jellyfin/root fi diff --git a/jellyfin/rootfs/etc/cont-init.d/99-database_clean.sh b/jellyfin/rootfs/etc/cont-init.d/99-database_clean.sh index 46c2440df..81212485f 100644 --- a/jellyfin/rootfs/etc/cont-init.d/99-database_clean.sh +++ b/jellyfin/rootfs/etc/cont-init.d/99-database_clean.sh @@ -5,5 +5,5 @@ db=/config/addons_config/jellyfin/data/data/library.db #Modify base if [ -f $db ]; then -sqlite3 -quote ${db} "UPDATE 'TypedBaseItems' SET data = replace( data, '/config/jellyfin/', '/config/addons_config/jellyfin/' ), path = replace( path, '/config/jellyfin/', '/config/addons_config/jellyfin/' ) WHERE type='MediaBrowser.Controller.Entities.CollectionFolder';" + sqlite3 -quote ${db} "UPDATE 'TypedBaseItems' SET data = replace( data, '/config/jellyfin/', '/config/addons_config/jellyfin/' ), path = replace( path, '/config/jellyfin/', '/config/addons_config/jellyfin/' ) WHERE type='MediaBrowser.Controller.Entities.CollectionFolder';" fi diff --git a/joal/rootfs/entrypoint.sh b/joal/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/joal/rootfs/entrypoint.sh +++ b/joal/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/joal/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/joal/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/joal/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/joal/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/joal/rootfs/etc/cont-init.d/99-run.sh b/joal/rootfs/etc/cont-init.d/99-run.sh index 2943a51fb..f5a61e872 100644 --- a/joal/rootfs/etc/cont-init.d/99-run.sh +++ b/joal/rootfs/etc/cont-init.d/99-run.sh @@ -12,15 +12,15 @@ VERBOSE=$(bashio::config 'verbose') || true # check password change if [ "$TOKEN" = "lrMY24Byhx" ]; then - bashio::log.warning "The token is still the default one, please change from addon options" + bashio::log.warning "The token is still the default one, please change from addon options" fi # download latest version if [ "$VERBOSE" = true ]; then - curl -f -J -L -o /tmp/joal.tar.gz "$(curl -f -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")" + curl -f -J -L -o /tmp/joal.tar.gz "$(curl -f -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")" else - curl -f -s -S -J -L -o /tmp/joal.tar.gz "$(curl -f -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")" >/dev/null + curl -f -s -S -J -L -o /tmp/joal.tar.gz "$(curl -f -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")" >/dev/null fi mkdir -p /data/joal tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null @@ -34,9 +34,9 @@ bashio::log.info "Joal updated" # If config doesn't exist, create it if [ ! -f /config/addons_config/joal/config.json ]; then - bashio::log.info "Symlinking config files" - mkdir -p /config/addons_config/joal - cp /data/joal/config.json /config/addons_config/joal/config.json + bashio::log.info "Symlinking config files" + mkdir -p /config/addons_config/joal + cp /data/joal/config.json /config/addons_config/joal/config.json fi # Refresh symlink @@ -86,9 +86,9 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log ############### if [ "$VERBOSE" = true ]; then - nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN" + nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN" else - nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN" >/dev/null + nohup java -jar /joal/joal.jar --joal-conf=/data/joal --spring.main.web-environment=true --server.port="8081" --joal.ui.path.prefix="${UIPATH}" --joal.ui.secret-token="$TOKEN" >/dev/null fi & bashio::log.info "Please wait, loading..." @@ -115,11 +115,11 @@ exec nginx & ########### if bashio::config.has_value 'run_duration'; then - RUNTIME=$(bashio::config 'run_duration') - bashio::log.info "Addon will stop after $RUNTIME" - sleep "$RUNTIME" && + RUNTIME=$(bashio::config 'run_duration') + bashio::log.info "Addon will stop after $RUNTIME" + sleep "$RUNTIME" && bashio::log.info "Timeout achieved, addon will stop !" && exit 0 else - bashio::log.info "Run_duration option not defined, addon will run continuously" + bashio::log.info "Run_duration option not defined, addon will run continuously" fi diff --git a/joplin/rootfs/entrypoint.sh b/joplin/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/joplin/rootfs/entrypoint.sh +++ b/joplin/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/joplin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/joplin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/joplin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/joplin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/joplin/rootfs/etc/cont-init.d/99-run.sh b/joplin/rootfs/etc/cont-init.d/99-run.sh index db31e7556..2cd76014b 100644 --- a/joplin/rootfs/etc/cont-init.d/99-run.sh +++ b/joplin/rootfs/etc/cont-init.d/99-run.sh @@ -7,42 +7,42 @@ bashio::log.warning "Warning - minimum configuration recommended : 2 cpu cores a # Check data location LOCATION=$(bashio::config 'data_location') if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then -# Default location -LOCATION="/config/addons_config/joplin" + # Default location + LOCATION="/config/addons_config/joplin" 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" + bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually" fi - # Create folder - if [ ! -d "$LOCATION" ]; then - echo "Creating $LOCATION" - mkdir -p "$LOCATION" - fi +# Create folder +if [ ! -d "$LOCATION" ]; then + echo "Creating $LOCATION" + mkdir -p "$LOCATION" +fi - touch "$LOCATION"/database.sqlite +touch "$LOCATION"/database.sqlite - if [ ! -d "$LOCATION"/resources ]; then - mkdir -p "$LOCATION"/resources - fi - ln -s "$LOCATION"/resources /home/joplin/packages/server +if [ ! -d "$LOCATION"/resources ]; then + mkdir -p "$LOCATION"/resources +fi +ln -s "$LOCATION"/resources /home/joplin/packages/server - chown -R joplin:joplin "$LOCATION" - chmod -R 777 "$LOCATION" - chmod 777 "$LOCATION/database.sqlite" - export SQLITE_DATABASE="$LOCATION/database.sqlite" +chown -R joplin:joplin "$LOCATION" +chmod -R 777 "$LOCATION" +chmod 777 "$LOCATION/database.sqlite" +export SQLITE_DATABASE="$LOCATION/database.sqlite" if bashio::config.has_value 'POSTGRES_DATABASE'; then -bashio::log.info "Using postgres" + bashio::log.info "Using postgres" -bashio::config.has_value 'DB_CLIENT' && export DB_CLIENT=$(bashio::config 'DB_CLIENT') && bashio::log.info 'Database client set' -bashio::config.has_value 'POSTGRES_PASSWORD' && export POSTGRES_PASSWORD=$(bashio::config 'POSTGRES_PASSWORD') && bashio::log.info 'Postgrep Password set' -bashio::config.has_value 'POSTGRES_DATABASE' && export POSTGRES_DATABASE=$(bashio::config 'POSTGRES_DATABASE') && bashio::log.info 'Postgrep Database set' -bashio::config.has_value 'POSTGRES_USER' && export POSTGRES_USER=$(bashio::config 'POSTGRES_USER') && bashio::log.info 'Postgrep User set' -bashio::config.has_value 'POSTGRES_PORT' && export POSTGRES_PORT=$(bashio::config 'POSTGRES_PORT') && bashio::log.info 'Postgrep Port set' -bashio::config.has_value 'POSTGRES_HOST' && export POSTGRES_HOST=$(bashio::config 'POSTGRES_HOST') && bashio::log.info 'Postgrep Host set' + bashio::config.has_value 'DB_CLIENT' && export DB_CLIENT=$(bashio::config 'DB_CLIENT') && bashio::log.info 'Database client set' + bashio::config.has_value 'POSTGRES_PASSWORD' && export POSTGRES_PASSWORD=$(bashio::config 'POSTGRES_PASSWORD') && bashio::log.info 'Postgrep Password set' + bashio::config.has_value 'POSTGRES_DATABASE' && export POSTGRES_DATABASE=$(bashio::config 'POSTGRES_DATABASE') && bashio::log.info 'Postgrep Database set' + bashio::config.has_value 'POSTGRES_USER' && export POSTGRES_USER=$(bashio::config 'POSTGRES_USER') && bashio::log.info 'Postgrep User set' + bashio::config.has_value 'POSTGRES_PORT' && export POSTGRES_PORT=$(bashio::config 'POSTGRES_PORT') && bashio::log.info 'Postgrep Port set' + bashio::config.has_value 'POSTGRES_HOST' && export POSTGRES_HOST=$(bashio::config 'POSTGRES_HOST') && bashio::log.info 'Postgrep Host set' else -bashio::log.info "Using sqlite" + bashio::log.info "Using sqlite" fi diff --git a/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/lidarr/rootfs/etc/cont-init.d/20-folders.sh b/lidarr/rootfs/etc/cont-init.d/20-folders.sh index 51a7b1772..31740be24 100644 --- a/lidarr/rootfs/etc/cont-init.d/20-folders.sh +++ b/lidarr/rootfs/etc/cont-init.d/20-folders.sh @@ -2,27 +2,27 @@ # shellcheck shell=bash if [ ! -d /share/music ]; then - echo "Creating /share/music" - mkdir -p /share/music - chown -R abc:abc /share/music + echo "Creating /share/music" + mkdir -p /share/music + chown -R abc:abc /share/music fi if [ ! -d /share/downloads ]; then - echo "Creating /share/downloads" - mkdir -p /share/downloads - chown -R abc:abc /share/downloads + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads fi if [ -d /config/lidarr ] && [ ! -d /config/addons_config/lidarr ]; then - echo "Moving to new location /config/addons_config/lidarr" - mkdir -p /config/addons_config/lidarr - chmod 777 /config/addons_config/lidarr - mv /config/lidarr/* /config/addons_config/lidarr/ - rm -r /config/lidarr + echo "Moving to new location /config/addons_config/lidarr" + mkdir -p /config/addons_config/lidarr + chmod 777 /config/addons_config/lidarr + mv /config/lidarr/* /config/addons_config/lidarr/ + rm -r /config/lidarr fi if [ ! -d /config/addons_config/lidarr ]; then - echo "Creating /config/addons_config/lidarr" - mkdir -p /config/addons_config/lidarr - chmod 777 /config/addons_config/lidarr + echo "Creating /config/addons_config/lidarr" + mkdir -p /config/addons_config/lidarr + chmod 777 /config/addons_config/lidarr fi diff --git a/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/nextcloud/rootfs/defaults/nextcloud-perms.sh b/nextcloud/rootfs/defaults/nextcloud-perms.sh index 83b9f6548..e93f482b4 100644 --- a/nextcloud/rootfs/defaults/nextcloud-perms.sh +++ b/nextcloud/rootfs/defaults/nextcloud-perms.sh @@ -46,10 +46,10 @@ chmod +x "${ocpath}"/occ printf "chmod/chown .htaccess\n" if [ -f "${ocpath}"/.htaccess ]; then - chmod 0644 "${ocpath}"/.htaccess - chown "${rootuser}":"${htgroup}" "${ocpath}"/.htaccess + chmod 0644 "${ocpath}"/.htaccess + chown "${rootuser}":"${htgroup}" "${ocpath}"/.htaccess fi if [ -f "${ocpath}"/data/.htaccess ]; then - chmod 0644 "${ocpath}"/data/.htaccess - chown "${rootuser}":"${htgroup}" "${ocpath}"/data/.htaccess + chmod 0644 "${ocpath}"/data/.htaccess + chown "${rootuser}":"${htgroup}" "${ocpath}"/data/.htaccess fi diff --git a/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/nextcloud/rootfs/etc/cont-init.d/10-adduser.sh b/nextcloud/rootfs/etc/cont-init.d/10-adduser.sh index 5b75936e5..7a94d879d 100644 --- a/nextcloud/rootfs/etc/cont-init.d/10-adduser.sh +++ b/nextcloud/rootfs/etc/cont-init.d/10-adduser.sh @@ -22,7 +22,7 @@ Brought to you by linuxserver.io -------------------------------------' if [[ -f /donate.txt ]]; then echo ' -To support the app dev(s) visit:' + To support the app dev(s) visit:' cat /donate.txt fi echo ' diff --git a/nextcloud/rootfs/etc/cont-init.d/30-keygen.sh b/nextcloud/rootfs/etc/cont-init.d/30-keygen.sh index bfad1b84c..0e3747333 100644 --- a/nextcloud/rootfs/etc/cont-init.d/30-keygen.sh +++ b/nextcloud/rootfs/etc/cont-init.d/30-keygen.sh @@ -3,22 +3,22 @@ if bashio::config.true 'use_own_certs'; then - bashio::log.info "Using referenced ssl certificates..." - CERTFILE=$(bashio::config 'certfile') - KEYFILE=$(bashio::config 'keyfile') + bashio::log.info "Using referenced ssl certificates..." + CERTFILE=$(bashio::config 'certfile') + KEYFILE=$(bashio::config 'keyfile') - #Check if files exist - echo "... checking if referenced files exist" - [ ! -f /ssl/"$CERTFILE" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$CERTFILE not found" && bashio::exit.nok - [ ! -f /ssl/"$KEYFILE" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$KEYFILE not found" && bashio::exit.nok + #Check if files exist + echo "... checking if referenced files exist" + [ ! -f /ssl/"$CERTFILE" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$CERTFILE not found" && bashio::exit.nok + [ ! -f /ssl/"$KEYFILE" ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$KEYFILE not found" && bashio::exit.nok else - mkdir -p /ssl/nextcloud/keys - bashio::log.info "No ssl certificates set. Auto generating ones..." - SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*" - openssl req -new -x509 -days 3650 -nodes -out /ssl/nextcloud/keys/cert.crt -keyout /ssl/nextcloud/keys/cert.key -subj "$SUBJECT" - CERTFILE="nextcloud/keys/cert.crt" - KEYFILE="nextcloud/keys/cert.key" + mkdir -p /ssl/nextcloud/keys + bashio::log.info "No ssl certificates set. Auto generating ones..." + SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*" + openssl req -new -x509 -days 3650 -nodes -out /ssl/nextcloud/keys/cert.crt -keyout /ssl/nextcloud/keys/cert.key -subj "$SUBJECT" + CERTFILE="nextcloud/keys/cert.crt" + KEYFILE="nextcloud/keys/cert.key" fi @@ -26,13 +26,13 @@ fi echo "... adding ssl certs in files" #Sets certificates for NGINXFILE in "/defaults/default" "/config/nginx/site-confs/default" "/data/config/nginx/site-confs/default"; do - if [ -f $NGINXFILE ]; then - LINE=$(sed -n "/ssl_certificate /=" $NGINXFILE) - if [[ -n "$LINE" ]]; then - sed -i "/ssl_certificate/ d" $NGINXFILE - sed -i "$LINE i ssl_certificate_key /ssl/$KEYFILE;" $NGINXFILE - sed -i "$LINE i ssl_certificate /ssl/$CERTFILE;" $NGINXFILE + if [ -f $NGINXFILE ]; then + LINE=$(sed -n "/ssl_certificate /=" $NGINXFILE) + if [[ -n "$LINE" ]]; then + sed -i "/ssl_certificate/ d" $NGINXFILE + sed -i "$LINE i ssl_certificate_key /ssl/$KEYFILE;" $NGINXFILE + sed -i "$LINE i ssl_certificate /ssl/$CERTFILE;" $NGINXFILE + fi fi - fi done bashio::log.info "... done" diff --git a/nextcloud/rootfs/etc/cont-init.d/40-config.sh b/nextcloud/rootfs/etc/cont-init.d/40-config.sh index 7135f52d3..c8cfea3c2 100644 --- a/nextcloud/rootfs/etc/cont-init.d/40-config.sh +++ b/nextcloud/rootfs/etc/cont-init.d/40-config.sh @@ -4,20 +4,20 @@ #create folders datadirectory=$(bashio::config 'data_directory') mkdir -p \ - "$datadirectory" \ - /data/config/nextcloud/config \ - /data/config/nextcloud/data \ - /data/config/www/nextcloud/config + "$datadirectory" \ + /data/config/nextcloud/config \ + /data/config/nextcloud/data \ + /data/config/www/nextcloud/config #permissions chown abc:abc \ - "$datadirectory" \ - /data/config/nextcloud/config \ - /data/config/nextcloud/data \ - /data/config/www/nextcloud/config + "$datadirectory" \ + /data/config/nextcloud/config \ + /data/config/nextcloud/data \ + /data/config/www/nextcloud/config chown -R abc:abc \ - /var/lib/nginx + /var/lib/nginx rm -r /data/config/www/nextcloud/assets &>/dev/null chmod -R 777 /data/config diff --git a/nextcloud/rootfs/etc/cont-init.d/50-install.sh b/nextcloud/rootfs/etc/cont-init.d/50-install.sh index b6063d1cf..11081832c 100644 --- a/nextcloud/rootfs/etc/cont-init.d/50-install.sh +++ b/nextcloud/rootfs/etc/cont-init.d/50-install.sh @@ -2,19 +2,19 @@ # create folders mkdir -p \ - "${NEXTCLOUD_PATH}" \ - /data/config/crontabs + "${NEXTCLOUD_PATH}" \ + /data/config/crontabs # install app if [ ! -e "${NEXTCLOUD_PATH}/index.php" ]; then - tar xf /app/nextcloud.tar.bz2 -C \ - "${NEXTCLOUD_PATH}" --strip-components=1 - chown abc:abc -R \ - "${NEXTCLOUD_PATH}" - chmod +x "${NEXTCLOUD_PATH}/occ" + tar xf /app/nextcloud.tar.bz2 -C \ + "${NEXTCLOUD_PATH}" --strip-components=1 + chown abc:abc -R \ + "${NEXTCLOUD_PATH}" + chmod +x "${NEXTCLOUD_PATH}/occ" fi #?set cronjob [[ ! -f /data/config/crontabs/root ]] && \ - cp /defaults/root /data/config/crontabs/root + cp /defaults/root /data/config/crontabs/root cp /data/config/crontabs/root /etc/crontabs/root diff --git a/nextcloud/rootfs/etc/cont-init.d/60-memcache.sh b/nextcloud/rootfs/etc/cont-init.d/60-memcache.sh index 279ef837d..c6bbb33be 100644 --- a/nextcloud/rootfs/etc/cont-init.d/60-memcache.sh +++ b/nextcloud/rootfs/etc/cont-init.d/60-memcache.sh @@ -8,8 +8,8 @@ sed -i "s|%%datadirectory%%|$datadirectory|g" /defaults/config.php # copy config [[ ! -f /data/config/www/nextcloud/config/config.php ]] && - cp /defaults/config.php /data/config/www/nextcloud/config/config.php +cp /defaults/config.php /data/config/www/nextcloud/config/config.php # permissions chown abc:abc \ - /data/config/www/nextcloud/config/config.php + /data/config/www/nextcloud/config/config.php diff --git a/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh b/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh index c53ab8116..de0d63b3c 100644 --- a/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-add_packages.sh @@ -1,10 +1,10 @@ #!/bin/bash if [ ! -d /data/config/www/nextcloud/apps/pdfannotate ]; then - CURRENT="$PWD" - cd /data/config/www/nextcloud/apps || exit - git clone https://gitlab.com/nextcloud-other/nextcloud-annotate pdfannotate - cd "$CURRENT" || exit - apk add --no-cache ghostscript >/dev/null - echo "Nextcloud annotate app added to Nextcloud app store" + CURRENT="$PWD" + cd /data/config/www/nextcloud/apps || exit + git clone https://gitlab.com/nextcloud-other/nextcloud-annotate pdfannotate + cd "$CURRENT" || exit + apk add --no-cache ghostscript >/dev/null + echo "Nextcloud annotate app added to Nextcloud app store" fi diff --git a/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh index 13a8af922..3db0b9fab 100644 --- a/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh +++ b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains.sh @@ -22,14 +22,14 @@ if bashio::config.has_value 'trusted_domains'; then $LAUNCHER config:system:get trusted_domains || bashio::log.info "No trusted domain set yet. The first one will be set when doing initial configuration" bashio::log.info "Trusted domains set in the configuration. Refreshing domains." && - ################################### - # Remove previous trusted domains # - ################################### - bashio::log.info "... removing previously added trusted domain (except for first one created)" + ################################### + # Remove previous trusted domains # + ################################### + bashio::log.info "... removing previously added trusted domain (except for first one created)" i=2 until [ $i -gt 5 ]; do $LAUNCHER config:system:delete trusted_domains $i && - ((i = i + 1)) || exit + ((i = i + 1)) || exit done ########################### diff --git a/nzbget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/nzbget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/nzbget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/nzbget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/nzbget/rootfs/etc/cont-init.d/20-folders.sh b/nzbget/rootfs/etc/cont-init.d/20-folders.sh index 0a1fef528..287c42782 100644 --- a/nzbget/rootfs/etc/cont-init.d/20-folders.sh +++ b/nzbget/rootfs/etc/cont-init.d/20-folders.sh @@ -5,15 +5,15 @@ slug=nzbget if [ ! -d /config/addons_config/$slug ]; then - if [ -d /config/$slug ]; then - echo "Moving to new location /config/addons_config/$slug" + if [ -d /config/$slug ]; then + echo "Moving to new location /config/addons_config/$slug" + mkdir -p /config/addons_config/$slug + chmod 777 /config/addons_config/$slug + mv /config/$slug/* /config/addons_config/$slug/ + rm -r /config/$slug + fi + + echo "Creating /config/addons_config/$slug" mkdir -p /config/addons_config/$slug chmod 777 /config/addons_config/$slug - mv /config/$slug/* /config/addons_config/$slug/ - rm -r /config/$slug - fi - - echo "Creating /config/addons_config/$slug" - mkdir -p /config/addons_config/$slug - chmod 777 /config/addons_config/$slug fi diff --git a/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/ombi/rootfs/etc/cont-init.d/20-folders.sh b/ombi/rootfs/etc/cont-init.d/20-folders.sh index 3fed51770..30190a685 100644 --- a/ombi/rootfs/etc/cont-init.d/20-folders.sh +++ b/ombi/rootfs/etc/cont-init.d/20-folders.sh @@ -5,15 +5,15 @@ slug=ombi if [ ! -d /config/addons_config/$slug ]; then - if [ -d /config/$slug ]; then - echo "Moving to new location /config/addons_config/$slug" + if [ -d /config/$slug ]; then + echo "Moving to new location /config/addons_config/$slug" + mkdir -p /config/addons_config/$slug + chmod 777 /config/addons_config/$slug + mv /config/$slug/* /config/addons_config/$slug/ + rm -r /config/$slug + fi + + echo "Creating /config/addons_config/$slug" mkdir -p /config/addons_config/$slug chmod 777 /config/addons_config/$slug - mv /config/$slug/* /config/addons_config/$slug/ - rm -r /config/$slug - fi - - echo "Creating /config/addons_config/$slug" - mkdir -p /config/addons_config/$slug - chmod 777 /config/addons_config/$slug fi diff --git a/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/organizr/rootfs/etc/cont-init.d/00-folders.sh b/organizr/rootfs/etc/cont-init.d/00-folders.sh index 27b6ce92c..a27545499 100644 --- a/organizr/rootfs/etc/cont-init.d/00-folders.sh +++ b/organizr/rootfs/etc/cont-init.d/00-folders.sh @@ -2,7 +2,7 @@ # shellcheck shell=bash if [ ! -d /data/organizr ]; then - echo "Creating /data/organizr" - mkdir -p /data/organizr - chown -R abc:abc /data/organizr + echo "Creating /data/organizr" + mkdir -p /data/organizr + chown -R abc:abc /data/organizr fi diff --git a/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/paperless_ng/rootfs/etc/cont-init.d/20-folders.sh b/paperless_ng/rootfs/etc/cont-init.d/20-folders.sh index 27902cd8b..cca546069 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/20-folders.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/20-folders.sh @@ -5,15 +5,15 @@ slug=paperless if [ ! -d /config/addons_config/$slug ]; then - if [ -d /config/$slug ]; then - echo "Moving to new location /config/addons_config/$slug" + if [ -d /config/$slug ]; then + echo "Moving to new location /config/addons_config/$slug" + mkdir -p /config/addons_config/$slug + chmod 777 /config/addons_config/$slug + mv /config/$slug/* /config/addons_config/$slug/ + rm -r /config/$slug + fi + + echo "Creating /config/addons_config/$slug" mkdir -p /config/addons_config/$slug chmod 777 /config/addons_config/$slug - mv /config/$slug/* /config/addons_config/$slug/ - rm -r /config/$slug - fi - - echo "Creating /config/addons_config/$slug" - mkdir -p /config/addons_config/$slug - chmod 777 /config/addons_config/$slug fi diff --git a/paperless_ng/rootfs/etc/cont-init.d/93-multiocr.sh b/paperless_ng/rootfs/etc/cont-init.d/93-multiocr.sh index 80240d3f2..36578a964 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/93-multiocr.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/93-multiocr.sh @@ -3,14 +3,14 @@ OCRLANG=$(bashio::config 'OCRLANG') if [ -n "$OCRLANG" ]; then - apt-get update &>/dev/null - echo "OCRLANG variable is set, processing the language packages" - for i in ${OCRLANG//,/ }; do - if apt-cache show tesseract-ocr-"${i}" >/dev/null 2>&1; then - apt-get install -yq tesseract-ocr-"${i}" - bashio::log.info "OCR Language installed : $i" || bashio::log.fatal "Couldn't install OCR lang $i. Please check its format is conform" - else - echo "package tesseract-ocr-${i} not found in the repository, skipping" - fi - done + apt-get update &>/dev/null + echo "OCRLANG variable is set, processing the language packages" + for i in ${OCRLANG//,/ }; do + if apt-cache show tesseract-ocr-"${i}" >/dev/null 2>&1; then + apt-get install -yq tesseract-ocr-"${i}" + bashio::log.info "OCR Language installed : $i" || bashio::log.fatal "Couldn't install OCR lang $i. Please check its format is conform" + else + echo "package tesseract-ocr-${i} not found in the repository, skipping" + fi + done fi diff --git a/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/papermerge/rootfs/etc/cont-init.d/00-folders.sh b/papermerge/rootfs/etc/cont-init.d/00-folders.sh index 869e4aae4..4243769b0 100644 --- a/papermerge/rootfs/etc/cont-init.d/00-folders.sh +++ b/papermerge/rootfs/etc/cont-init.d/00-folders.sh @@ -11,9 +11,9 @@ mkdir -p "$CONFIGLOCATION"/config # Copy previous config if existing if [ -d /data/config ]; then - echo "Moving to new location $CONFIGLOCATION" - mv /data/config/* "$CONFIGLOCATION"/config/ - rm -r /data/config + echo "Moving to new location $CONFIGLOCATION" + mv /data/config/* "$CONFIGLOCATION"/config/ + rm -r /data/config fi # Make sure permissions are right diff --git a/papermerge/rootfs/etc/cont-init.d/99-configuration.sh b/papermerge/rootfs/etc/cont-init.d/99-configuration.sh index 31c7ee7e8..ede53201c 100644 --- a/papermerge/rootfs/etc/cont-init.d/99-configuration.sh +++ b/papermerge/rootfs/etc/cont-init.d/99-configuration.sh @@ -26,20 +26,20 @@ bashio::log.info "Import dir set to $IMPORTDIR" ################## if [ ! -d /config ]; then - echo "Creating /config" - mkdir -p /config + echo "Creating /config" + mkdir -p /config fi chown -R abc:abc /config if [ ! -d "$MEDIADIR" ]; then - echo "Creating $MEDIADIR" - mkdir -p "$MEDIADIR" + echo "Creating $MEDIADIR" + mkdir -p "$MEDIADIR" fi chown -R abc:abc "$MEDIADIR" if [ ! -d "$IMPORTDIR" ]; then - echo "Creating $IMPORTDIR" - mkdir -p "$IMPORTDIR" + echo "Creating $IMPORTDIR" + mkdir -p "$IMPORTDIR" fi chown -R abc:abc "$IMPORTDIR" diff --git a/photoprism/rootfs/entrypoint.sh b/photoprism/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/photoprism/rootfs/entrypoint.sh +++ b/photoprism/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/photoprism/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/photoprism/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/photoprism/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/photoprism/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/photoprism/rootfs/etc/cont-init.d/99-run.sh b/photoprism/rootfs/etc/cont-init.d/99-run.sh index ae9b4c39b..1e0cd4455 100644 --- a/photoprism/rootfs/etc/cont-init.d/99-run.sh +++ b/photoprism/rootfs/etc/cont-init.d/99-run.sh @@ -9,41 +9,41 @@ bashio::log.info "Defining database" case $(bashio::config 'DB_TYPE') in -# Use sqlite -sqlite) - bashio::log.info "Using a local sqlite database" - ;; + # Use sqlite + sqlite) + bashio::log.info "Using a local sqlite database" + ;; -mariadb_addon) - bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." - if ! bashio::services.available 'mysql'; then - bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" - bashio::exit.nok \ - "Please ensure it is installed and started" - fi + mariadb_addon) + bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." + if ! bashio::services.available 'mysql'; then + bashio::log.fatal \ + "Local database access should be provided by the MariaDB addon" + bashio::exit.nok \ + "Please ensure it is installed and started" + fi - # Install mysqlclient - pip install pymysql &>/dev/null || true + # Install mysqlclient + pip install pymysql &>/dev/null || true - # Use values - PHOTOPRISM_DATABASE_DRIVER="mysql" - PHOTOPRISM_DATABASE_SERVER="$(bashio::services 'mysql' 'host'):$(bashio::services 'mysql' 'port')" - PHOTOPRISM_DATABASE_NAME="photoprism" - PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')" - PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')" - export PHOTOPRISM_DATABASE_DRIVER && bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER" - export PHOTOPRISM_DATABASE_SERVER && bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER" - export PHOTOPRISM_DATABASE_NAME && bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME" - export PHOTOPRISM_DATABASE_USER && bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER" - export PHOTOPRISM_DATABASE_PASSWORD && bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD" + # Use values + PHOTOPRISM_DATABASE_DRIVER="mysql" + PHOTOPRISM_DATABASE_SERVER="$(bashio::services 'mysql' 'host'):$(bashio::services 'mysql' 'port')" + PHOTOPRISM_DATABASE_NAME="photoprism" + PHOTOPRISM_DATABASE_USER="$(bashio::services 'mysql' 'username')" + PHOTOPRISM_DATABASE_PASSWORD="$(bashio::services 'mysql' 'password')" + export PHOTOPRISM_DATABASE_DRIVER && bashio::log.blue "PHOTOPRISM_DATABASE_DRIVER=$PHOTOPRISM_DATABASE_DRIVER" + export PHOTOPRISM_DATABASE_SERVER && bashio::log.blue "PHOTOPRISM_DATABASE_SERVER=$PHOTOPRISM_DATABASE_SERVER" + export PHOTOPRISM_DATABASE_NAME && bashio::log.blue "PHOTOPRISM_DATABASE_NAME=$PHOTOPRISM_DATABASE_NAME" + export PHOTOPRISM_DATABASE_USER && bashio::log.blue "PHOTOPRISM_DATABASE_USER=$PHOTOPRISM_DATABASE_USER" + export PHOTOPRISM_DATABASE_PASSWORD && bashio::log.blue "PHOTOPRISM_DATABASE_PASSWORD=$PHOTOPRISM_DATABASE_PASSWORD" - bashio::log.warning "Webtrees is using the Maria DB addon" - bashio::log.warning "Please ensure this is included in your backups" - bashio::log.warning "Uninstalling the MariaDB addon will remove any data" + bashio::log.warning "Webtrees is using the Maria DB addon" + bashio::log.warning "Please ensure this is included in your backups" + bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - mysql --host="$(bashio::services 'mysql' 'host')" --port="$(bashio::services 'mysql' 'port')" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"CREATE DATABASE IF NOT EXISTS $PHOTOPRISM_DATABASE_NAME; CHARACTER SET = utf8mb4; COLLATE = utf8mb4_unicode_ci;" || true - ;; + mysql --host="$(bashio::services 'mysql' 'host')" --port="$(bashio::services 'mysql' 'port')" --user="$PHOTOPRISM_DATABASE_USER" --password="$PHOTOPRISM_DATABASE_PASSWORD" -e"CREATE DATABASE IF NOT EXISTS $PHOTOPRISM_DATABASE_NAME; CHARACTER SET = utf8mb4; COLLATE = utf8mb4_unicode_ci;" || true + ;; esac ############## @@ -64,16 +64,16 @@ export PHOTOPRISM_BACKUP_PATH # Test configs for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do - # Check if path exists - if bashio::fs.directory_exists "$variabletest"; then - true - else - bashio::log.info "Path $variabletest doesn't exist. Creating it now..." - mkdir -p "$variabletest" || bashio::log.fatal "Can't create $variabletest path" - fi - # Check if path writable - # shellcheck disable=SC2015 - touch "$variabletest"/aze && rm "$variabletest"/aze || bashio::log.fatal "$variabletest path is not writable" + # Check if path exists + if bashio::fs.directory_exists "$variabletest"; then + true + else + bashio::log.info "Path $variabletest doesn't exist. Creating it now..." + mkdir -p "$variabletest" || bashio::log.fatal "Can't create $variabletest path" + fi + # Check if path writable + # shellcheck disable=SC2015 + touch "$variabletest"/aze && rm "$variabletest"/aze || bashio::log.fatal "$variabletest path is not writable" done # Start messages diff --git a/photoprism/rootfs/run.sh b/photoprism/rootfs/run.sh index 457a2ce7f..7f399b516 100644 --- a/photoprism/rootfs/run.sh +++ b/photoprism/rootfs/run.sh @@ -7,13 +7,13 @@ ########### for SCRIPTS in "/00-banner.sh" "/92-local_mounts.sh" "/92-smb_mounts.sh"; do - echo $SCRIPTS - chown "$(id -u)":"$(id -g)" "$SCRIPTS" - chmod a+x $SCRIPTS - sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS - /.$SCRIPTS && + echo $SCRIPTS + chown "$(id -u)":"$(id -g)" "$SCRIPTS" + chmod a+x $SCRIPTS + sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS + /.$SCRIPTS && true || true # Prevents script crash on failure - echo "exit $?" + echo "exit $?" done ############## @@ -28,23 +28,23 @@ export PHOTOPRISM_IMPORT_PATH=$(bashio::config 'IMPORT_PATH') export PHOTOPRISM_BACKUP_PATH=$(bashio::config 'BACKUP_PATH') if bashio::config.has_value 'CUSTOM_OPTIONS'; then - CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS') + CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS') else - CUSTOMOPTIONS="" + CUSTOMOPTIONS="" fi # Test configs for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do - # Check if path exists - if bashio::fs.directory_exists "$variabletest"; then - true - else - bashio::log.info "Path $variabletest doesn't exist. Creating it now..." - mkdir -p "$variabletest" || bashio::log.fatal "Can't create $variabletest path" - fi - # Check if path writable - # shellcheck disable=SC2015 - touch "$variabletest"/aze && rm "$variabletest"/aze || bashio::log.fatal "$variabletest path is not writable" + # Check if path exists + if bashio::fs.directory_exists "$variabletest"; then + true + else + bashio::log.info "Path $variabletest doesn't exist. Creating it now..." + mkdir -p "$variabletest" || bashio::log.fatal "Can't create $variabletest path" + fi + # Check if path writable + # shellcheck disable=SC2015 + touch "$variabletest"/aze && rm "$variabletest"/aze || bashio::log.fatal "$variabletest path is not writable" done # Start messages diff --git a/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/piwigo/rootfs/etc/cont-init.d/41-folders.sh b/piwigo/rootfs/etc/cont-init.d/41-folders.sh index 2b7c98d91..ececf91ad 100644 --- a/piwigo/rootfs/etc/cont-init.d/41-folders.sh +++ b/piwigo/rootfs/etc/cont-init.d/41-folders.sh @@ -8,33 +8,33 @@ #Create folders if [ ! -d /share/piwigo ]; then - echo "Creating /share/piwigo" - mkdir -p /share/piwigo - chown -R abc:abc /share/piwigo + echo "Creating /share/piwigo" + mkdir -p /share/piwigo + chown -R abc:abc /share/piwigo else - chown -R abc:abc /share/piwigo + chown -R abc:abc /share/piwigo fi if [ ! -d /share/piwigo/config ]; then - echo "moving config folder" - mv /gallery/local/config /share/piwigo - ln -s /share/piwigo/config /gallery/local - echo "links done" + echo "moving config folder" + mv /gallery/local/config /share/piwigo + ln -s /share/piwigo/config /gallery/local + echo "links done" else - rm -r /gallery/local/config - ln -s /share/piwigo/config /gallery/local - echo "Using existing config" + rm -r /gallery/local/config + ln -s /share/piwigo/config /gallery/local + echo "Using existing config" fi if [ ! -d /share/piwigo/keys ]; then - echo "moving keys folder" - mv /config/keys /share/piwigo - ln -s /share/piwigo/keys /config - echo "links done" + echo "moving keys folder" + mv /config/keys /share/piwigo + ln -s /share/piwigo/keys /config + echo "links done" else - rm -r /config/keys - ln -s /share/piwigo/keys /config - echo "Using existing keys folder" + rm -r /config/keys + ln -s /share/piwigo/keys /config + echo "Using existing keys folder" fi ################## diff --git a/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/plex/rootfs/etc/cont-init.d/21-folders.sh b/plex/rootfs/etc/cont-init.d/21-folders.sh index c9210f581..224a316cd 100644 --- a/plex/rootfs/etc/cont-init.d/21-folders.sh +++ b/plex/rootfs/etc/cont-init.d/21-folders.sh @@ -8,20 +8,20 @@ echo "Database stored in /share/plex" if [ ! -d "/share/plex/Plex Media Server" ]; then - echo "... creating /share/plex/Plex Media Server" - mkdir -p "/share/plex/Plex Media Server" + echo "... creating /share/plex/Plex Media Server" + mkdir -p "/share/plex/Plex Media Server" fi if [ -d "/config/Library/Application Support/Plex Media Server" ]; then - echo "... creating /symlink" - rm -r "/config/Library/Application Support/*" - ln -s "/share/plex/Plex Media Server" "/config/Library/Application Support" + echo "... creating /symlink" + rm -r "/config/Library/Application Support/*" + ln -s "/share/plex/Plex Media Server" "/config/Library/Application Support" fi if [ ! -d "/config/Library/Application Support" ]; then - echo "... creating /symlink" - mkdir -p "/config/Library/Application Support" - ln -s "/share/plex/Plex Media Server" "/config/Library/Application Support" + echo "... creating /symlink" + mkdir -p "/config/Library/Application Support" + ln -s "/share/plex/Plex Media Server" "/config/Library/Application Support" fi chown -R abc:abc /share/plex diff --git a/plex/rootfs/etc/cont-init.d/90-create_links.sh b/plex/rootfs/etc/cont-init.d/90-create_links.sh index 054fe81db..76515c838 100644 --- a/plex/rootfs/etc/cont-init.d/90-create_links.sh +++ b/plex/rootfs/etc/cont-init.d/90-create_links.sh @@ -5,20 +5,20 @@ ################## if [ ! -d /share/plex ]; then - echo "Creating /share/plex" - mkdir -p /share/plex - chown -R abc:abc /share/plex + echo "Creating /share/plex" + mkdir -p /share/plex + chown -R abc:abc /share/plex else - chown -R abc:abc /share/plex + chown -R abc:abc /share/plex fi if [ ! -d /share/plex/Library ]; then - echo "moving Library folder" - mv /config/Library /share/plex - ln -s /share/plex/Library /config - echo "links done" + echo "moving Library folder" + mv /config/Library /share/plex + ln -s /share/plex/Library /config + echo "links done" else - rm -r /config/Library - ln -s /share/plex/Library /config - echo "Using existing config" + rm -r /config/Library + ln -s /share/plex/Library /config + echo "Using existing config" fi diff --git a/plex_meta_manager/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/plex_meta_manager/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/plex_meta_manager/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/plex_meta_manager/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh b/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh index cd430ba33..67dc1ab3e 100644 --- a/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh +++ b/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh @@ -12,8 +12,8 @@ PUID=$(bashio::config 'PUID') PGID=$(bashio::config 'PGID') if [ ! -d "$(dirname "${CONFIGSOURCE}")" ]; then - echo "Creating $(dirname "${CONFIGSOURCE}")" - mkdir -p "$(dirname "${CONFIGSOURCE}")" + echo "Creating $(dirname "${CONFIGSOURCE}")" + mkdir -p "$(dirname "${CONFIGSOURCE}")" fi chown -R "$PUID":"$PGID" "$(dirname "${CONFIGSOURCE}")" diff --git a/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh b/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh index 46abd22c2..0728b6b21 100644 --- a/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh +++ b/portainer/rootfs/etc/cont-init.d/00-aaa_portainer_install.sh @@ -18,6 +18,6 @@ if [ -e "/PORTFILE" ]; then curl -f -L -s \ "https://github.com/portainer/portainer/releases/download/${BUILD_UPSTREAM}/portainer-${BUILD_UPSTREAM}-linux-${ARCH}.tar.gz" | - tar zxvf - -C /opt/ + tar zxvf - -C /opt/ echo "... success!" fi diff --git a/portainer/rootfs/etc/cont-init.d/30-nginx.sh b/portainer/rootfs/etc/cont-init.d/30-nginx.sh index c5f479d72..400a6ad54 100644 --- a/portainer/rootfs/etc/cont-init.d/30-nginx.sh +++ b/portainer/rootfs/etc/cont-init.d/30-nginx.sh @@ -27,6 +27,6 @@ bashio::var.json \ certfile "$(bashio::config 'certfile')" \ keyfile "$(bashio::config 'keyfile')" \ ssl "^$(bashio::config 'ssl')" | - tempio \ - -template /etc/nginx/templates/ingress.gtpl \ - -out /etc/nginx/servers/ingress.conf +tempio \ + -template /etc/nginx/templates/ingress.gtpl \ + -out /etc/nginx/servers/ingress.conf diff --git a/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/prowlarr/rootfs/etc/cont-init.d/20-folders.sh b/prowlarr/rootfs/etc/cont-init.d/20-folders.sh index 10a5bdc48..d1887dc88 100644 --- a/prowlarr/rootfs/etc/cont-init.d/20-folders.sh +++ b/prowlarr/rootfs/etc/cont-init.d/20-folders.sh @@ -1,15 +1,15 @@ #!/bin/bash if [ -d /config/prowlarr ] && [ ! -d /config/addons_config/prowlarr ]; then - echo "Moving to new location /config/addons_config/prowlarr" - mkdir -p /config/addons_config/prowlarr - chown -R abc:abc /config/addons_config/prowlarr - mv /config/prowlarr/* /config/addons_config/prowlarr/ - rm -r /config/prowlarr + echo "Moving to new location /config/addons_config/prowlarr" + mkdir -p /config/addons_config/prowlarr + chown -R abc:abc /config/addons_config/prowlarr + mv /config/prowlarr/* /config/addons_config/prowlarr/ + rm -r /config/prowlarr fi if [ ! -d /config/addons_config/prowlarr ]; then - echo "Creating /config/addons_config/prowlarr" - mkdir -p /config/addons_config/prowlarr - chown -R abc:abc /config/addons_config/prowlarr + echo "Creating /config/addons_config/prowlarr" + mkdir -p /config/addons_config/prowlarr + chown -R abc:abc /config/addons_config/prowlarr fi diff --git a/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh b/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh index 3e6c3d194..55350e45d 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh @@ -39,7 +39,7 @@ LATEST_RELEASE=$(curl -f -s --retry 5 -L https://api.github.com/repos/wdaan/vuet grep "browser_download_url.*zip" | cut -d : -f 2,3 | tr -d \" | - xargs) +xargs) [ "$DEBUG" = "debug" ] && echo "Before curl" curl -f -s -S -O -J -L "$LATEST_RELEASE" diff --git a/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh b/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh index 1515f84e7..e4fea8c31 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh @@ -16,11 +16,11 @@ LINE=$((LINE + 1)) ########### if bashio::config.has_value 'run_duration'; then - rm /etc/services.d/qbittorrent/run - mv /etc/services.d/qbittorrent/timer /etc/services.d/qbittorrent/run - chmod +x /etc/services.d/qbittorrent/run + rm /etc/services.d/qbittorrent/run + mv /etc/services.d/qbittorrent/timer /etc/services.d/qbittorrent/run + chmod +x /etc/services.d/qbittorrent/run else - rm /etc/services.d/qbittorrent/timer + rm /etc/services.d/qbittorrent/timer fi ################## @@ -33,16 +33,16 @@ DOWNLOADS=$(bashio::config 'SavePath') # Set configuration if bashio::config.has_value 'SavePath'; then - # Replace save path - CURRENTSAVEPATH=$(sed -n '/Downloads\\SavePath/p' qBittorrent.conf) - sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf 2>/dev/null || true + # Replace save path + CURRENTSAVEPATH=$(sed -n '/Downloads\\SavePath/p' qBittorrent.conf) + sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf 2>/dev/null || true - # Replace session save path - CURRENTSAVEPATH=$(sed -n '/Session\\DefaultSavePath/p' qBittorrent.conf) - sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf 2>/dev/null || true + # Replace session save path + CURRENTSAVEPATH=$(sed -n '/Session\\DefaultSavePath/p' qBittorrent.conf) + sed -i "s|${CURRENTSAVEPATH#*=}|$DOWNLOADS|g" qBittorrent.conf 2>/dev/null || true - # Info - bashio::log.info "Downloads can be found in $DOWNLOADS" + # Info + bashio::log.info "Downloads can be found in $DOWNLOADS" fi # Create default location @@ -78,15 +78,15 @@ sed -i '/HTTPS/d' qBittorrent.conf bashio::config.require.ssl if bashio::config.true 'ssl'; then - bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" - #set variables - CERTFILE=$(bashio::config 'certfile') - KEYFILE=$(bashio::config 'keyfile') + bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" + #set variables + CERTFILE=$(bashio::config 'certfile') + KEYFILE=$(bashio::config 'keyfile') - #Modify configuration - sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf - sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf - sed -i "$LINE i\WebUI\\\HTTPS\\\KeyPath=/ssl/$KEYFILE" qBittorrent.conf + #Modify configuration + sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf + sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf + sed -i "$LINE i\WebUI\\\HTTPS\\\KeyPath=/ssl/$KEYFILE" qBittorrent.conf fi ################ @@ -95,12 +95,12 @@ fi cd /config/qBittorrent/ || true if bashio::config.has_value 'whitelist'; then - WHITELIST=$(bashio::config 'whitelist') - #clean data - sed -i '/AuthSubnetWhitelist/d' qBittorrent.conf - sed -i "$LINE i\WebUI\\\AuthSubnetWhitelistEnabled=true" qBittorrent.conf - sed -i "$LINE i\WebUI\\\AuthSubnetWhitelist=$WHITELIST" qBittorrent.conf - bashio::log.info "Whitelisted subsets will not require a password : $WHITELIST" + WHITELIST=$(bashio::config 'whitelist') + #clean data + sed -i '/AuthSubnetWhitelist/d' qBittorrent.conf + sed -i "$LINE i\WebUI\\\AuthSubnetWhitelistEnabled=true" qBittorrent.conf + sed -i "$LINE i\WebUI\\\AuthSubnetWhitelist=$WHITELIST" qBittorrent.conf + bashio::log.info "Whitelisted subsets will not require a password : $WHITELIST" fi ############### @@ -109,12 +109,12 @@ fi cd /config/qBittorrent/ || true if bashio::config.has_value 'Username'; then - USERNAME=$(bashio::config 'Username') - #clean data - sed -i '/WebUI\\\Username/d' qBittorrent.conf - #add data - sed -i "$LINE i\WebUI\\\Username=$USERNAME" qBittorrent.conf - bashio::log.info "WEBUI username set to $USERNAME" + USERNAME=$(bashio::config 'Username') + #clean data + sed -i '/WebUI\\\Username/d' qBittorrent.conf + #add data + sed -i "$LINE i\WebUI\\\Username=$USERNAME" qBittorrent.conf + bashio::log.info "WEBUI username set to $USERNAME" fi ################ @@ -135,17 +135,17 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ]; then ### Download WebUI case $CUSTOMUI in - "vuetorrent") - curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip" | head -1)" >/dev/null - ;; + "vuetorrent") + curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip" | head -1)" >/dev/null + ;; - "qbit-matUI") - curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip" | head -1)" >/dev/null - ;; + "qbit-matUI") + curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip" | head -1)" >/dev/null + ;; - "qb-web") - curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip" | head -1)" >/dev/null - ;; + "qb-web") + curl -f -s -S -J -L -o /webui/release.zip "$(curl -f -s https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip" | head -1)" >/dev/null + ;; esac diff --git a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh index eacd6a8fc..299567259 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh @@ -8,84 +8,84 @@ declare openvpn_password if bashio::config.true 'openvpn_enabled'; then - bashio::log.info "Configuring openvpn" + bashio::log.info "Configuring openvpn" - ############### - # ENABLE IPV6 # - ############### - - # { echo "net.ipv6.conf.all.disable_ipv6 = 0"; - # echo "net.ipv6.conf.default.disable_ipv6 = 0"; - # echo "net.ipv6.conf.lo.disable_ipv6 = 0"; } >> /etc/sysctl.conf || true - - # sysctl -p || true + ############### + # ENABLE IPV6 # + ############### - ##################### - # CONFIGURE OPENVPN # - ##################### + # { echo "net.ipv6.conf.all.disable_ipv6 = 0"; + # echo "net.ipv6.conf.default.disable_ipv6 = 0"; + # echo "net.ipv6.conf.lo.disable_ipv6 = 0"; } >> /etc/sysctl.conf || true - openvpn_config=$(bashio::config 'openvpn_config') + # sysctl -p || true - cp "/config/openvpn/${openvpn_config}" /etc/openvpn/config.ovpn || bashio::log.error "openvpn config file not found in /config/openvpn/${openvpn_config}" + ##################### + # CONFIGURE OPENVPN # + ##################### - openvpn_username=$(bashio::config 'openvpn_username') - echo "${openvpn_username}" >/etc/openvpn/credentials - openvpn_password=$(bashio::config 'openvpn_password') - echo "${openvpn_password}" >>/etc/openvpn/credentials - sed -i 's/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g' /etc/openvpn/config.ovpn + openvpn_config=$(bashio::config 'openvpn_config') - # Permissions - chmod 600 /etc/openvpn/credentials - chmod 755 /etc/openvpn/up.sh - chmod 755 /etc/openvpn/down.sh - chmod 755 /etc/openvpn/up-qbittorrent.sh - chmod +x /etc/openvpn/up.sh - chmod +x /etc/openvpn/up-qbittorrent.sh + cp "/config/openvpn/${openvpn_config}" /etc/openvpn/config.ovpn || bashio::log.error "openvpn config file not found in /config/openvpn/${openvpn_config}" - bashio::log.info "openvpn correctly set, qbittorrent will run tunnelled through openvpn" + openvpn_username=$(bashio::config 'openvpn_username') + echo "${openvpn_username}" >/etc/openvpn/credentials + openvpn_password=$(bashio::config 'openvpn_password') + echo "${openvpn_password}" >>/etc/openvpn/credentials + sed -i 's/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g' /etc/openvpn/config.ovpn - ######################### - # CONFIGURE QBITTORRENT # - ######################### + # Permissions + chmod 600 /etc/openvpn/credentials + chmod 755 /etc/openvpn/up.sh + chmod 755 /etc/openvpn/down.sh + chmod 755 /etc/openvpn/up-qbittorrent.sh + chmod +x /etc/openvpn/up.sh + chmod +x /etc/openvpn/up-qbittorrent.sh - QBT_CONFIG_FILE="/config/qBittorrent/qBittorrent.conf" - # Define preferences line - cd /config/qBittorrent/ || exit 1 - LINE=$(sed -n '/Preferences/=' qBittorrent.conf) - LINE=$((LINE + 1)) - SESSION=$(sed -n '/BitTorrent/=' qBittorrent.conf) + bashio::log.info "openvpn correctly set, qbittorrent will run tunnelled through openvpn" - # If qBittorrent.conf exists - if [ -f "$QBT_CONFIG_FILE" ]; then - # Remove previous line and bind tun0 - sed -i '/Interface/d' qBittorrent.conf + ######################### + # CONFIGURE QBITTORRENT # + ######################### - # Bind tun0 - sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf - sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf + QBT_CONFIG_FILE="/config/qBittorrent/qBittorrent.conf" + # Define preferences line + cd /config/qBittorrent/ || exit 1 + LINE=$(sed -n '/Preferences/=' qBittorrent.conf) + LINE=$((LINE + 1)) + SESSION=$(sed -n '/BitTorrent/=' qBittorrent.conf) - if [ "$SESSION" != "" ]; then - SESSION=$((SESSION + 1)) - sed -i "$SESSION i\Session\\\Interface=tun0" qBittorrent.conf - sed -i "$SESSION i\Session\\\InterfaceName=tun0" qBittorrent.conf + # If qBittorrent.conf exists + if [ -f "$QBT_CONFIG_FILE" ]; then + # Remove previous line and bind tun0 + sed -i '/Interface/d' qBittorrent.conf + + # Bind tun0 + sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf + sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf + + if [ "$SESSION" != "" ]; then + SESSION=$((SESSION + 1)) + sed -i "$SESSION i\Session\\\Interface=tun0" qBittorrent.conf + sed -i "$SESSION i\Session\\\InterfaceName=tun0" qBittorrent.conf + fi + + else + bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options " + exit 1 fi - - else - bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options " - exit 1 - fi - # Modify ovpn config - echo "route-nopull" >>/etc/openvpn/config.ovpn + # Modify ovpn config + echo "route-nopull" >>/etc/openvpn/config.ovpn else - ################## - # REMOVE OPENVPN # - ################## - # Ensure no redirection by removing the direction tag - cd /config/qBittorrent/ || exit 1 - sed -i '/Interface/d' qBittorrent.conf - bashio::log.info "Direct connection without VPN enabled" + ################## + # REMOVE OPENVPN # + ################## + # Ensure no redirection by removing the direction tag + cd /config/qBittorrent/ || exit 1 + sed -i '/Interface/d' qBittorrent.conf + bashio::log.info "Direct connection without VPN enabled" fi diff --git a/qbittorrent/rootfs/etc/openvpn/down.sh b/qbittorrent/rootfs/etc/openvpn/down.sh index 665e4ae33..a83f98272 100644 --- a/qbittorrent/rootfs/etc/openvpn/down.sh +++ b/qbittorrent/rootfs/etc/openvpn/down.sh @@ -6,27 +6,27 @@ # If we have a service specific script, run this now if [ -x /etc/openvpn/"${RC_SVCNAME}"-down.sh ] ; then - /etc/openvpn/"${RC_SVCNAME}"-down.sh "$@" + /etc/openvpn/"${RC_SVCNAME}"-down.sh "$@" fi # Restore resolv.conf to how it was if [ "${PEER_DNS}" != "no" ]; then - if [ -x /sbin/resolvconf ] ; then - /sbin/resolvconf -d "${dev}" - elif [ -e /etc/resolv.conf-"${dev}".sv ] ; then - # Important that we cat instead of move incase resolv.conf is - # a symlink and not an actual file - cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf - rm -f /etc/resolv.conf-"${dev}".sv - fi + if [ -x /sbin/resolvconf ] ; then + /sbin/resolvconf -d "${dev}" + elif [ -e /etc/resolv.conf-"${dev}".sv ] ; then + # Important that we cat instead of move incase resolv.conf is + # a symlink and not an actual file + cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf + rm -f /etc/resolv.conf-"${dev}".sv + fi fi if [ -n "${RC_SVCNAME}" ]; then - # Re-enter the init script to start any dependant services - if /etc/init.d/"${RC_SVCNAME}" --quiet status ; then - export IN_BACKGROUND=true - /etc/init.d/"${RC_SVCNAME}" --quiet stop - fi + # Re-enter the init script to start any dependant services + if /etc/init.d/"${RC_SVCNAME}" --quiet status ; then + export IN_BACKGROUND=true + /etc/init.d/"${RC_SVCNAME}" --quiet stop + fi fi exit 0 diff --git a/qbittorrent/rootfs/etc/openvpn/up.sh b/qbittorrent/rootfs/etc/openvpn/up.sh index 5f496d9bf..c5486d267 100644 --- a/qbittorrent/rootfs/etc/openvpn/up.sh +++ b/qbittorrent/rootfs/etc/openvpn/up.sh @@ -25,44 +25,44 @@ # and try and let resolvconf handle it if [ "${PEER_DNS}" != "no" ]; then - NS= - DOMAIN= - SEARCH= - i=1 - while true ; do - eval opt=\$foreign_option_${i} - [ -z "${opt}" ] && break - if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then - if [ -z "${DOMAIN}" ] ; then - DOMAIN="${opt#dhcp-option DOMAIN *}" - else - SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}" - fi - elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then - NS="${NS}nameserver ${opt#dhcp-option DNS *}\n" - fi - i=$((${i} + 1)) - done + NS= + DOMAIN= + SEARCH= + i=1 + while true ; do + eval opt=\$foreign_option_${i} + [ -z "${opt}" ] && break + if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then + if [ -z "${DOMAIN}" ] ; then + DOMAIN="${opt#dhcp-option DOMAIN *}" + else + SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}" + fi + elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then + NS="${NS}nameserver ${opt#dhcp-option DNS *}\n" + fi + i=$((${i} + 1)) + done - if [ -n "${NS}" ] ; then - DNS="# Generated by openvpn for interface ${dev}\n" - if [ -n "${SEARCH}" ] ; then - DNS="${DNS}search ${DOMAIN} ${SEARCH}\n" - elif [ -n "${DOMAIN}" ]; then - DNS="${DNS}domain ${DOMAIN}\n" - fi - DNS="${DNS}${NS}" - if [ -x /sbin/resolvconf ] ; then - printf "${DNS}" | /sbin/resolvconf -a "${dev}" - else - # Preserve the existing resolv.conf - if [ -e /etc/resolv.conf ] ; then - cp /etc/resolv.conf /etc/resolv.conf-"${dev}".sv - fi - printf "${DNS}" > /etc/resolv.conf - chmod 644 /etc/resolv.conf - fi - fi + if [ -n "${NS}" ] ; then + DNS="# Generated by openvpn for interface ${dev}\n" + if [ -n "${SEARCH}" ] ; then + DNS="${DNS}search ${DOMAIN} ${SEARCH}\n" + elif [ -n "${DOMAIN}" ]; then + DNS="${DNS}domain ${DOMAIN}\n" + fi + DNS="${DNS}${NS}" + if [ -x /sbin/resolvconf ] ; then + printf "${DNS}" | /sbin/resolvconf -a "${dev}" + else + # Preserve the existing resolv.conf + if [ -e /etc/resolv.conf ] ; then + cp /etc/resolv.conf /etc/resolv.conf-"${dev}".sv + fi + printf "${DNS}" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + fi + fi fi # Below section is Gentoo specific @@ -70,16 +70,16 @@ fi # as we could have >1 openvpn service if [ -n "${RC_SVCNAME}" ]; then - # If we have a service specific script, run this now - if [ -x /etc/openvpn/"${RC_SVCNAME}"-up.sh ] ; then - /etc/openvpn/"${RC_SVCNAME}"-up.sh "$@" - fi + # If we have a service specific script, run this now + if [ -x /etc/openvpn/"${RC_SVCNAME}"-up.sh ] ; then + /etc/openvpn/"${RC_SVCNAME}"-up.sh "$@" + fi - # Re-enter the init script to start any dependant services - if ! /etc/init.d/"${RC_SVCNAME}" --quiet status ; then - export IN_BACKGROUND=true - /etc/init.d/${RC_SVCNAME} --quiet start - fi + # Re-enter the init script to start any dependant services + if ! /etc/init.d/"${RC_SVCNAME}" --quiet status ; then + export IN_BACKGROUND=true + /etc/init.d/${RC_SVCNAME} --quiet start + fi fi ############### diff --git a/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/radarr/rootfs/etc/cont-init.d/20-folders.sh b/radarr/rootfs/etc/cont-init.d/20-folders.sh index f497e47b3..3785e80ea 100644 --- a/radarr/rootfs/etc/cont-init.d/20-folders.sh +++ b/radarr/rootfs/etc/cont-init.d/20-folders.sh @@ -1,27 +1,27 @@ #!/bin/bash if [ ! -d /share/storage/movies ]; then - echo "Creating /share/storage/movies" - mkdir -p /share/storage/movies - chown -R abc:abc /share/storage/movies + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies fi if [ ! -d /share/downloads ]; then - echo "Creating /share/downloads" - mkdir -p /share/downloads - chown -R abc:abc /share/downloads + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads fi if [ -d /config/radarr ] && [ ! -d /config/addons_config/radarr ]; then - echo "Moving to new location /config/addons_config/radarr" - mkdir -p /config/addons_config/radarr - chown -R abc:abc /config/addons_config/radarr - mv /config/radarr/* /config/addons_config/radarr/ - rm -r /config/radarr + echo "Moving to new location /config/addons_config/radarr" + mkdir -p /config/addons_config/radarr + chown -R abc:abc /config/addons_config/radarr + mv /config/radarr/* /config/addons_config/radarr/ + rm -r /config/radarr fi if [ ! -d /config/addons_config/radarr ]; then - echo "Creating /config/addons_config/radarr" - mkdir -p /config/addons_config/radarr - chown -R abc:abc /config/addons_config/radarr + echo "Creating /config/addons_config/radarr" + mkdir -p /config/addons_config/radarr + chown -R abc:abc /config/addons_config/radarr fi diff --git a/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/readarr/rootfs/etc/cont-init.d/20-folders.sh b/readarr/rootfs/etc/cont-init.d/20-folders.sh index ee243a46c..122bd888b 100644 --- a/readarr/rootfs/etc/cont-init.d/20-folders.sh +++ b/readarr/rootfs/etc/cont-init.d/20-folders.sh @@ -1,27 +1,27 @@ #!/bin/bash if [ ! -d /share/storage/ebook ]; then - echo "Creating /share/storage/ebook" - mkdir -p /share/storage/ebook - chown -R abc:abc /share/storage/ebook + echo "Creating /share/storage/ebook" + mkdir -p /share/storage/ebook + chown -R abc:abc /share/storage/ebook fi if [ ! -d /share/downloads ]; then - echo "Creating /share/downloads" - mkdir -p /share/downloads - chown -R abc:abc /share/downloads + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads fi if [ -d /config/readarr ] && [ ! -d /config/addons_config/readarr ]; then - echo "Moving to new location /config/addons_config/readarr" - mkdir -p /config/addons_config/readarr - chown -R abc:abc /config/addons_config/readarr - mv /config/readarr/* /config/addons_config/readarr/ - rm -r /config/readarr + echo "Moving to new location /config/addons_config/readarr" + mkdir -p /config/addons_config/readarr + chown -R abc:abc /config/addons_config/readarr + mv /config/readarr/* /config/addons_config/readarr/ + rm -r /config/readarr fi if [ ! -d /config/addons_config/readarr ]; then - echo "Creating /config/addons_config/readarr" - mkdir -p /config/addons_config/readarr - chown -R abc:abc /config/addons_config/readarr + echo "Creating /config/addons_config/readarr" + mkdir -p /config/addons_config/readarr + chown -R abc:abc /config/addons_config/readarr fi diff --git a/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/scrutiny/rootfs/etc/cont-init.d/31-run.sh b/scrutiny/rootfs/etc/cont-init.d/31-run.sh index 4947166c4..209a63bcd 100644 --- a/scrutiny/rootfs/etc/cont-init.d/31-run.sh +++ b/scrutiny/rootfs/etc/cont-init.d/31-run.sh @@ -36,15 +36,15 @@ FREQUENCY=$(bashio::config 'Updates') bashio::log.info "$FREQUENCY updates" case $FREQUENCY in -"Hourly") - sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root - ;; + "Hourly") + sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root + ;; -"Daily") - sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root - ;; + "Daily") + sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root + ;; -"Weekly") - sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root - ;; + "Weekly") + sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root + ;; esac diff --git a/scrutiny_fa/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/scrutiny_fa/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/scrutiny_fa/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/scrutiny_fa/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh b/scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh index c745b827c..24f0fcb7a 100644 --- a/scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh +++ b/scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh @@ -42,15 +42,15 @@ FREQUENCY=$(bashio::config 'Updates') bashio::log.info "$FREQUENCY updates" case $FREQUENCY in -"Hourly") - sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root - ;; + "Hourly") + sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root + ;; -"Daily") - sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root - ;; + "Daily") + sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root + ;; -"Weekly") - sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root - ;; + "Weekly") + sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root + ;; esac diff --git a/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/sonarr/rootfs/etc/cont-init.d/20-folders.sh b/sonarr/rootfs/etc/cont-init.d/20-folders.sh index 36f96c5ed..f48deff0d 100644 --- a/sonarr/rootfs/etc/cont-init.d/20-folders.sh +++ b/sonarr/rootfs/etc/cont-init.d/20-folders.sh @@ -1,27 +1,27 @@ #!/bin/bash if [ ! -d /share/storage/tv ]; then - echo "Creating /share/storage/tv" - mkdir -p /share/storage/tv - chown -R abc:abc /share/storage/tv + echo "Creating /share/storage/tv" + mkdir -p /share/storage/tv + chown -R abc:abc /share/storage/tv fi if [ ! -d /share/downloads ]; then - echo "Creating /share/downloads" - mkdir -p /share/downloads - chown -R abc:abc /share/downloads + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads fi if [ -d /config/sonarr ] && [ ! -d /config/addons_config/sonarr ]; then - echo "Moving to new location /config/addons_config/sonarr" - mkdir -p /config/addons_config/sonarr - chown -R abc:abc /config/addons_config/sonarr - mv /config/sonarr/* /config/addons_config/sonarr/ - rm -r /config/sonarr + echo "Moving to new location /config/addons_config/sonarr" + mkdir -p /config/addons_config/sonarr + chown -R abc:abc /config/addons_config/sonarr + mv /config/sonarr/* /config/addons_config/sonarr/ + rm -r /config/sonarr fi if [ ! -d /config/addons_config/sonarr ]; then - echo "Creating /config/addons_config/sonarr" - mkdir -p /config/addons_config/sonarr - chown -R abc:abc /config/addons_config/sonarr + echo "Creating /config/addons_config/sonarr" + mkdir -p /config/addons_config/sonarr + chown -R abc:abc /config/addons_config/sonarr fi diff --git a/spotweb/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/spotweb/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/spotweb/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/spotweb/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/tandoor_recipes/rootfs/entrypoint.sh b/tandoor_recipes/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/tandoor_recipes/rootfs/entrypoint.sh +++ b/tandoor_recipes/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/tandoor_recipes/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/tandoor_recipes/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/tandoor_recipes/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/tandoor_recipes/rootfs/etc/cont-init.d/20-folders.sh b/tandoor_recipes/rootfs/etc/cont-init.d/20-folders.sh index 2650b5073..bfefebf96 100644 --- a/tandoor_recipes/rootfs/etc/cont-init.d/20-folders.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/20-folders.sh @@ -4,7 +4,7 @@ slug="tandoor_recipes" if [ ! -d /config/addons_config/$slug ]; then - echo "Creating /config/addons_config/$slug" - mkdir -p /config/addons_config/$slug + echo "Creating /config/addons_config/$slug" + mkdir -p /config/addons_config/$slug fi chmod -R 755 /config/addons_config/$slug diff --git a/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh b/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh index cd24a7aca..2b2372432 100644 --- a/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh @@ -17,49 +17,49 @@ bashio::log.info "Defining database" export DB_TYPE=$(bashio::config 'DB_TYPE') case $(bashio::config 'DB_TYPE') in -# Use sqlite -sqlite) - bashio::log.info "Using a local sqlite database" - export DB_ENGINE="django.db.backends.sqlite3" - export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db" - ;; + # Use sqlite + sqlite) + bashio::log.info "Using a local sqlite database" + export DB_ENGINE="django.db.backends.sqlite3" + export POSTGRES_DB="/config/addons_config/tandoor_recipes/recipes.db" + ;; -mariadb_addon) - bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." - if ! bashio::services.available 'mysql'; then - bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" - bashio::exit.nok \ - "Please ensure it is installed and started" - fi + mariadb_addon) + bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." + if ! bashio::services.available 'mysql'; then + bashio::log.fatal \ + "Local database access should be provided by the MariaDB addon" + bashio::exit.nok \ + "Please ensure it is installed and started" + fi - # Install mysqlclient - pip install pymysql &>/dev/null + # Install mysqlclient + pip install pymysql &>/dev/null - # Use values - export DB_ENGINE=django.db.backends.mysql - export POSTGRES_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST" - export POSTGRES_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT" - export POSTGRES_DB=/data/ + # Use values + export DB_ENGINE=django.db.backends.mysql + export POSTGRES_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST" + export POSTGRES_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT" + export POSTGRES_DB=/data/ - .db && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB" - export POSTGRES_USER=$(bashio::services "mysql" "username") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER" - export POSTGRES_PASSWORD=$(bashio::services "mysql" "password") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" + .db && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB" + export POSTGRES_USER=$(bashio::services "mysql" "username") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER" + export POSTGRES_PASSWORD=$(bashio::services "mysql" "password") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" - bashio::log.warning "Webtrees is using the Maria DB addon" - bashio::log.warning "Please ensure this is included in your backups" - bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - ;; + bashio::log.warning "Webtrees is using the Maria DB addon" + bashio::log.warning "Please ensure this is included in your backups" + bashio::log.warning "Uninstalling the MariaDB addon will remove any data" + ;; -postgresql_external) - bashio::log.info "Using an external database, please populate all required fields in the addons config" - export DB_ENGINE=django.db.backends.postgresql - export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST" - export POSTGRES_PORT=$(bashio::config "POSTGRES_PORT") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT" - export POSTGRES_DB=$(bashio::config "POSTGRES_DB") && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB" - export POSTGRES_USER=$(bashio::config "POSTGRES_USER") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER" - export POSTGRES_PASSWORD=$(bashio::config "POSTGRES_PASSWORD") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" - ;; + postgresql_external) + bashio::log.info "Using an external database, please populate all required fields in the addons config" + export DB_ENGINE=django.db.backends.postgresql + export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST" + export POSTGRES_PORT=$(bashio::config "POSTGRES_PORT") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT" + export POSTGRES_DB=$(bashio::config "POSTGRES_DB") && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB" + export POSTGRES_USER=$(bashio::config "POSTGRES_USER") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER" + export POSTGRES_PASSWORD=$(bashio::config "POSTGRES_PASSWORD") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" + ;; esac diff --git a/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/transmission/rootfs/etc/cont-init.d/19-config.sh b/transmission/rootfs/etc/cont-init.d/19-config.sh index b845e4ca3..6b0bff747 100644 --- a/transmission/rootfs/etc/cont-init.d/19-config.sh +++ b/transmission/rootfs/etc/cont-init.d/19-config.sh @@ -24,8 +24,8 @@ mkdir -p /config/transmission || true chown -R abc:abc /config/transmission || true if ! bashio::fs.file_exists "$CONFIGDIR/settings.json"; then - echo "Creating default config" - cp "/defaults/settings.json" "$CONFIGDIR/settings.json" + echo "Creating default config" + cp "/defaults/settings.json" "$CONFIGDIR/settings.json" fi ################# @@ -36,16 +36,16 @@ fi ############## if bashio::config.has_value 'customUI'; then - CUSTOMUI=$(bashio::config 'customUI') - [ "$CUSTOMUI" != "standard" ] && sed -i "1a export TRANSMISSION_WEB_HOME=\"/$CUSTOMUI/\"" /etc/services.d/transmission/run + CUSTOMUI=$(bashio::config 'customUI') + [ "$CUSTOMUI" != "standard" ] && sed -i "1a export TRANSMISSION_WEB_HOME=\"/$CUSTOMUI/\"" /etc/services.d/transmission/run - # Enable transmission-web-control return to default UI - if [ ! -f "/transmission-web-control/index.original.html" ]; then - ln -s /usr/share/transmission/web/style /transmission-web-control - ln -s /usr/share/transmission/web/images /transmission-web-control - ln -s /usr/share/transmission/web/javascript /transmission-web-control - ln -s /usr/share/transmission/web/index.html /transmission-web-control/index.original.html - fi + # Enable transmission-web-control return to default UI + if [ ! -f "/transmission-web-control/index.original.html" ]; then + ln -s /usr/share/transmission/web/style /transmission-web-control + ln -s /usr/share/transmission/web/images /transmission-web-control + ln -s /usr/share/transmission/web/javascript /transmission-web-control + ln -s /usr/share/transmission/web/index.html /transmission-web-control/index.original.html + fi fi bashio::log.info "UI selected : $CUSTOMUI" @@ -64,13 +64,13 @@ chown abc:abc "$download_dir" # if incomplete dir > 2, to allow both null and '', set it as existing if [ ${#incomplete_dir} -ge 2 ]; then - echo "Incomplete dir set: $incomplete_dir" - CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=true") - mkdir -p "$incomplete_dir" - chown abc:abc "$incomplete_dir" + echo "Incomplete dir set: $incomplete_dir" + CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=true") + mkdir -p "$incomplete_dir" + chown abc:abc "$incomplete_dir" else - echo "Incomplete dir disabled" - CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=false") + echo "Incomplete dir disabled" + CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=false") fi # Defaults @@ -80,7 +80,7 @@ CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-host-whitelist-enabled\"=false") CONFIG=$(bashio::jq "${CONFIG}" ".\"bind-address-ipv4\"=\"0.0.0.0\"") echo "${CONFIG}" >"$CONFIGDIR"/settings.json && - jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json $CONFIGDIR/settings.json +jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json $CONFIGDIR/settings.json # USER and PASS ############### @@ -89,17 +89,17 @@ CONFIG=$(<"$CONFIGDIR"/settings.json) USER=$(bashio::config 'user') PASS=$(bashio::config 'pass') if bashio::config.has_value 'user'; then - BOOLEAN=true - bashio::log.info "User & Pass set, authentification will be with user : $USER and pass : $PASS" + BOOLEAN=true + bashio::log.info "User & Pass set, authentification will be with user : $USER and pass : $PASS" else - BOOLEAN=false - bashio::log.warning "User & Pass not set, no authentification required" + BOOLEAN=false + bashio::log.warning "User & Pass not set, no authentification required" fi CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${BOOLEAN}") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${USER}\"") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${PASS}\"") echo "${CONFIG}" >"$CONFIGDIR"/settings.json && - jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json +jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json # WHITELIST ########### @@ -107,13 +107,13 @@ echo "${CONFIG}" >"$CONFIGDIR"/settings.json && CONFIG=$(<"$CONFIGDIR"/settings.json) WHITELIST=$(bashio::config 'whitelist') if bashio::config.has_value 'whitelist'; then - BOOLEAN=true - bashio::log.info "Whitelist set, no authentification from IP $WHITELIST" + BOOLEAN=true + bashio::log.info "Whitelist set, no authentification from IP $WHITELIST" else - BOOLEAN=false - sed -i "2 i\"rpc-whitelist-enabled\": false," "$CONFIGDIR"/settings.json + BOOLEAN=false + sed -i "2 i\"rpc-whitelist-enabled\": false," "$CONFIGDIR"/settings.json fi CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=${BOOLEAN}") CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist\"=\"$WHITELIST\"") echo "${CONFIG}" >"$CONFIGDIR"/settings.json && - jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json +jq . -S "$CONFIGDIR"/settings.json | cat >temp.json && mv temp.json "$CONFIGDIR"/settings.json diff --git a/ubooquity/rootfs/etc/32-nginx_ingress.sh b/ubooquity/rootfs/etc/32-nginx_ingress.sh index 8a846abdc..a41162763 100644 --- a/ubooquity/rootfs/etc/32-nginx_ingress.sh +++ b/ubooquity/rootfs/etc/32-nginx_ingress.sh @@ -14,13 +14,13 @@ declare port port=$(bashio::addon.ingress_port) # shellcheck disable=SC2210 if [ "$port" ] >1; then - # Adapt nginx - sed -i "s|%%port%%|$port|g" /etc/nginx/servers/ingress.conf - sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ingress.conf - # Removebaseurl - jq '.reverseProxyPrefix = ""' /config/addons_config/ubooquity/preferences.json | sponge /config/addons_config/ubooquity/preferences.json - # Log - bashio::log.info "Ingress enabled" + # Adapt nginx + sed -i "s|%%port%%|$port|g" /etc/nginx/servers/ingress.conf + sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ingress.conf + # Removebaseurl + jq '.reverseProxyPrefix = ""' /config/addons_config/ubooquity/preferences.json | sponge /config/addons_config/ubooquity/preferences.json + # Log + bashio::log.info "Ingress enabled" else - rm /etc/nginx/servers/ingress.conf + rm /etc/nginx/servers/ingress.conf fi diff --git a/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/ubooquity/rootfs/etc/cont-init.d/20-folders.sh b/ubooquity/rootfs/etc/cont-init.d/20-folders.sh index 6eb91d333..aa3708a4d 100644 --- a/ubooquity/rootfs/etc/cont-init.d/20-folders.sh +++ b/ubooquity/rootfs/etc/cont-init.d/20-folders.sh @@ -5,15 +5,15 @@ slug=ubooquity if [ ! -d /config/addons_config/$slug ]; then - if [ -d /config/$slug ]; then - echo "Moving to new location /config/addons_config/$slug" + if [ -d /config/$slug ]; then + echo "Moving to new location /config/addons_config/$slug" + mkdir -p /config/addons_config/$slug + chmod 777 /config/addons_config/$slug + mv /config/$slug/* /config/addons_config/$slug/ + rm -r /config/$slug + fi + + echo "Creating /config/addons_config/$slug" mkdir -p /config/addons_config/$slug chmod 777 /config/addons_config/$slug - mv /config/$slug/* /config/addons_config/$slug/ - rm -r /config/$slug - fi - - echo "Creating /config/addons_config/$slug" - mkdir -p /config/addons_config/$slug - chmod 777 /config/addons_config/$slug fi diff --git a/ubooquity/rootfs/etc/cont-init.d/32-nginx_ssl.sh b/ubooquity/rootfs/etc/cont-init.d/32-nginx_ssl.sh index 2c08711ca..98bc7c320 100644 --- a/ubooquity/rootfs/etc/cont-init.d/32-nginx_ssl.sh +++ b/ubooquity/rootfs/etc/cont-init.d/32-nginx_ssl.sh @@ -17,11 +17,11 @@ sed -i "s|%%interface%%|$(bashio::addon.ip_address)|g" /etc/nginx/servers/ssl.co # Ssl values if bashio::config.true 'ssl'; then - bashio::config.require.ssl - certfile=$(bashio::config 'certfile') - keyfile=$(bashio::config 'keyfile') - sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf - sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf - sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf - bashio::log.info "Ssl enabled, please use https for connection. UI is at https://YOURIP:$(bashio::addon.port 2205)/ubooquity ; admin is at https://YOURIP:$(bashio::addon.port 2206)/ubooquity/admin" + bashio::config.require.ssl + certfile=$(bashio::config 'certfile') + keyfile=$(bashio::config 'keyfile') + sed -i "s|default_server|ssl|g" /etc/nginx/servers/ssl.conf + sed -i "/proxy_params.conf/a ssl_certificate /ssl/$certfile;" /etc/nginx/servers/ssl.conf + sed -i "/proxy_params.conf/a ssl_certificate_key /ssl/$keyfile;" /etc/nginx/servers/ssl.conf + bashio::log.info "Ssl enabled, please use https for connection. UI is at https://YOURIP:$(bashio::addon.port 2205)/ubooquity ; admin is at https://YOURIP:$(bashio::addon.port 2206)/ubooquity/admin" fi diff --git a/ubooquity/rootfs/etc/cont-init.d/93-custom_webUI.sh b/ubooquity/rootfs/etc/cont-init.d/93-custom_webUI.sh index 23226c4c1..aa57e4a71 100644 --- a/ubooquity/rootfs/etc/cont-init.d/93-custom_webUI.sh +++ b/ubooquity/rootfs/etc/cont-init.d/93-custom_webUI.sh @@ -6,29 +6,29 @@ ################ if bashio::config.has_value 'theme'; then - ### Variables - CUSTOMUI=$(bashio::config 'theme') - bashio::log.info "Alternate theme enabled : $CUSTOMUI. If webui don't work, disable this option" + ### Variables + CUSTOMUI=$(bashio::config 'theme') + bashio::log.info "Alternate theme enabled : $CUSTOMUI. If webui don't work, disable this option" - ### Download WebUI - case "$CUSTOMUI" in - "comixology2") - curl -f -s -S -J -L -o /data/release.zip https://github.com/scooterpsu/Comixology_Ubooquity_2/releases/download/v3.4/comixology2.zip >/dev/null && - unzip -o -q /data/release.zip -d /config/addons_config/ubooquity/themes/ - ;; + ### Download WebUI + case "$CUSTOMUI" in + "comixology2") + curl -f -s -S -J -L -o /data/release.zip https://github.com/scooterpsu/Comixology_Ubooquity_2/releases/download/v3.4/comixology2.zip >/dev/null && + unzip -o -q /data/release.zip -d /config/addons_config/ubooquity/themes/ + ;; - "plextheme-master") - curl -f -s -S -J -L -o /data/release.zip https://github.com/FinalAngel/plextheme/archive/master.zip >/dev/null && - unzip -q /data/release.zip -d /config/addons_config/ubooquity/themes/ - # && mv /config/addons_config/ubooquity/themes/plextheme-master/ /config/addons_config/ubooquity/themes/ - ;; + "plextheme-master") + curl -f -s -S -J -L -o /data/release.zip https://github.com/FinalAngel/plextheme/archive/master.zip >/dev/null && + unzip -q /data/release.zip -d /config/addons_config/ubooquity/themes/ + # && mv /config/addons_config/ubooquity/themes/plextheme-master/ /config/addons_config/ubooquity/themes/ + ;; - esac + esac - ### Clean files - rm /data/release.zip || true + ### Clean files + rm /data/release.zip || true - ### Set preference - jq --arg variable "$CUSTOMUI" '.theme = $variable' /config/addons_config/ubooquity/preferences.json | sponge /config/addons_config/ubooquity/preferences.json + ### Set preference + jq --arg variable "$CUSTOMUI" '.theme = $variable' /config/addons_config/ubooquity/preferences.json | sponge /config/addons_config/ubooquity/preferences.json fi diff --git a/webtop_kde/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/webtop_kde/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/webtop_kde/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/webtop_kde/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh b/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh index 3117ca8ca..2475f9d73 100644 --- a/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh +++ b/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh @@ -9,23 +9,23 @@ PGID=$(bashio::config "PGID") LOCATION=$(bashio::config 'data_location') if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then -# Default location -LOCATION="/share/webtop_kde" + # 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" + 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 + # 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 + 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 diff --git a/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh b/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh index ece1d428a..6560fec5a 100644 --- a/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh +++ b/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh @@ -4,49 +4,49 @@ # Add Edge repositories if bashio::config.true 'edge_repositories'; then -bashio::log.info "Changing app repositories to edge" -{ echo "https://dl-cdn.alpinelinux.org/alpine/edge/community"; - echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing"; - echo "https://dl-cdn.alpinelinux.org/alpine/edge/main"; } > /etc/apk/repositories + bashio::log.info "Changing app repositories to edge" + { echo "https://dl-cdn.alpinelinux.org/alpine/edge/community"; + echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing"; + echo "https://dl-cdn.alpinelinux.org/alpine/edge/main"; } > /etc/apk/repositories fi # 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?" + 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 + 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 - apk add --no-cache "$APP" >/dev/null || bashio::log.red "... not successful, please check package name" - done + 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 + apk add --no-cache "$APP" >/dev/null || bashio::log.red "... not successful, please check package name" + done 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/services.d/web/run + KEYBOARD=$(bashio::config 'KEYBOARD') + bashio::log.info "Setting keyboard to $KEYBOARD" + sed -i "1a export KEYBOARD=$KEYBOARD" /etc/services.d/web/run 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 + 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 diff --git a/webtrees/rootfs/entrypoint.sh b/webtrees/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/webtrees/rootfs/entrypoint.sh +++ b/webtrees/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/webtrees/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/webtrees/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/webtrees/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/webtrees/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/webtrees/rootfs/etc/cont-init.d/99-run.sh b/webtrees/rootfs/etc/cont-init.d/99-run.sh index 328335ef6..1d1555e76 100644 --- a/webtrees/rootfs/etc/cont-init.d/99-run.sh +++ b/webtrees/rootfs/etc/cont-init.d/99-run.sh @@ -18,36 +18,36 @@ bashio::log.info "Defining database" export DB_TYPE=$(bashio::config 'DB_TYPE') case $(bashio::config 'DB_TYPE') in -# Use sqlite -sqlite) - bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS" - ;; + # Use sqlite + sqlite) + bashio::log.info "Using a local sqlite database $WEBTREES_HOME/$DB_NAME please wait then login. Default credentials : $WT_USER : $WT_PASS" + ;; -mariadb_addon) - bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." - if ! bashio::services.available 'mysql'; then - bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" - bashio::exit.nok \ - "Please ensure it is installed and started" - fi + mariadb_addon) + bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..." + if ! bashio::services.available 'mysql'; then + bashio::log.fatal \ + "Local database access should be provided by the MariaDB addon" + bashio::exit.nok \ + "Please ensure it is installed and started" + fi - # Use values - export DB_TYPE=mysql - export DB_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "DB_HOST=$DB_HOST" - export DB_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "DB_PORT=$DB_PORT" - export DB_NAME=webtrees && bashio::log.blue "DB_NAME=$DB_NAME" - export DB_USER=$(bashio::services "mysql" "username") && bashio::log.blue "DB_USER=$DB_USER" - export DB_PASS=$(bashio::services "mysql" "password") && bashio::log.blue "DB_PASS=$DB_PASS" + # Use values + export DB_TYPE=mysql + export DB_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "DB_HOST=$DB_HOST" + export DB_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "DB_PORT=$DB_PORT" + export DB_NAME=webtrees && bashio::log.blue "DB_NAME=$DB_NAME" + export DB_USER=$(bashio::services "mysql" "username") && bashio::log.blue "DB_USER=$DB_USER" + export DB_PASS=$(bashio::services "mysql" "password") && bashio::log.blue "DB_PASS=$DB_PASS" - bashio::log.warning "Webtrees is using the Maria DB addon" - bashio::log.warning "Please ensure this is included in your backups" - bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - ;; + bashio::log.warning "Webtrees is using the Maria DB addon" + bashio::log.warning "Please ensure this is included in your backups" + bashio::log.warning "Uninstalling the MariaDB addon will remove any data" + ;; -external) - bashio::log.info "Using an external database, please populate all required fields in the config.yaml according to dovumentation" - ;; + external) + bashio::log.info "Using an external database, please populate all required fields in the config.yaml according to dovumentation" + ;; esac diff --git a/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/whoogle/rootfs/entrypoint.sh b/whoogle/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/whoogle/rootfs/entrypoint.sh +++ b/whoogle/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/whoogle/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/whoogle/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/whoogle/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/whoogle/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/zoneminder/rootfs/entrypoint.sh b/zoneminder/rootfs/entrypoint.sh index 9becb179e..85d8a9212 100644 --- a/zoneminder/rootfs/entrypoint.sh +++ b/zoneminder/rootfs/entrypoint.sh @@ -6,10 +6,10 @@ echo "Starting..." ############################ if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then - chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh - chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh - /./etc/cont-init.d/00-aaa_dockerfile_backup.sh - rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh + chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh + /./etc/cont-init.d/00-aaa_dockerfile_backup.sh + rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh fi #################### @@ -17,11 +17,11 @@ fi #################### 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 $?" + [ -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 diff --git a/zoneminder/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/zoneminder/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 98dddfe70..8989b365f 100644 --- a/zoneminder/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/zoneminder/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then echo "Executing modules script : $MODULES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && mkdir -p /etc/cont-init.d \ - && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ - && chmod -R 755 /etc/cont-init.d + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && mkdir -p /etc/cont-init.d \ + && for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \ + && chmod -R 755 /etc/cont-init.d fi ####################### @@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then echo "Executing dependency script with custom elements : $PACKAGES" if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ - && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ - && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ - && chmod 777 /automatic_packages.sh \ - && eval /./automatic_packages.sh "${PACKAGES:-}" \ - && rm /automatic_packages.sh + && if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \ + && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \ + && chmod 777 /automatic_packages.sh \ + && eval /./automatic_packages.sh "${PACKAGES:-}" \ + && rm /automatic_packages.sh fi diff --git a/zoneminder/rootfs/etc/cont-init.d/99-run.sh b/zoneminder/rootfs/etc/cont-init.d/99-run.sh index 075e48649..d2c0fa8c6 100644 --- a/zoneminder/rootfs/etc/cont-init.d/99-run.sh +++ b/zoneminder/rootfs/etc/cont-init.d/99-run.sh @@ -9,8 +9,8 @@ CONFIGSOURCE="/config/addons_config/zoneminder" if [ ! -f "$CONFIGSOURCE"/zm.conf ]; then -# Copy conf files -cp /etc/zm/zm.conf "$CONFIGSOURCE" + # Copy conf files + cp /etc/zm/zm.conf "$CONFIGSOURCE" fi ################### @@ -20,57 +20,57 @@ fi bashio::log.info "Defining database" case "$(bashio::config "DB_CONNECTION")" in -# Use MariaDB -mariadb_addon) - bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." - if ! bashio::services.available 'mysql'; then - bashio::log.fatal \ - "Local database access should be provided by the MariaDB addon" - bashio::exit.nok \ - "Please ensure it is installed and started" - fi - - # Use values - DB_CONNECTION=mysql - ZM_DB_HOST=$(bashio::services "mysql" "host") - ZM_DB_PORT=$(bashio::services "mysql" "port") - ZM_DB_NAME=firefly - ZM_DB_USER=$(bashio::services "mysql" "username") - ZM_DB_PASS=$(bashio::services "mysql" "password") - export DB_CONNECTION - export remoteDB=1 - export ZM_DB_HOST && bashio::log.blue "ZM_DB_HOST=$ZM_DB_HOST" - export ZM_DB_PORT && bashio::log.blue "ZM_DB_PORT=$ZM_DB_PORT" - export ZM_DB_NAME && bashio::log.blue "ZM_DB_NAME=$ZM_DB_NAME" - export ZM_DB_USER && bashio::log.blue "ZM_DB_USER=$ZM_DB_USER" - export ZM_DB_PASS && bashio::log.blue "ZM_DB_PASS=$ZM_DB_PASS" - - bashio::log.warning "Firefly-iii is using the Maria DB addon" - bashio::log.warning "Please ensure this is included in your backups" - bashio::log.warning "Uninstalling the MariaDB addon will remove any data" - - bashio::log.info "Creating database for Firefly-iii if required" - mysql \ - -u "${ZM_DB_USER}" -p"${ZM_DB_PASS}" \ - -h "${ZM_DB_HOST}" -P "${ZM_DB_PORT}" \ - -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" - ;; - -# Use remote -external) - bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" - for conditions in "ZM_DB_HOST" "ZM_DB_PORT" "ZM_DB_NAME" "ZM_DB_USER" "ZM_DB_PASS"; do - if ! bashio::config.has_value "$conditions"; then - bashio::exit.nok "Remote database has been specified but $conditions is not defined in addon options" + # Use MariaDB + mariadb_addon) + bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Detecting values..." + if ! bashio::services.available 'mysql'; then + bashio::log.fatal \ + "Local database access should be provided by the MariaDB addon" + bashio::exit.nok \ + "Please ensure it is installed and started" fi - done - ;; + + # Use values + DB_CONNECTION=mysql + ZM_DB_HOST=$(bashio::services "mysql" "host") + ZM_DB_PORT=$(bashio::services "mysql" "port") + ZM_DB_NAME=firefly + ZM_DB_USER=$(bashio::services "mysql" "username") + ZM_DB_PASS=$(bashio::services "mysql" "password") + export DB_CONNECTION + export remoteDB=1 + export ZM_DB_HOST && bashio::log.blue "ZM_DB_HOST=$ZM_DB_HOST" + export ZM_DB_PORT && bashio::log.blue "ZM_DB_PORT=$ZM_DB_PORT" + export ZM_DB_NAME && bashio::log.blue "ZM_DB_NAME=$ZM_DB_NAME" + export ZM_DB_USER && bashio::log.blue "ZM_DB_USER=$ZM_DB_USER" + export ZM_DB_PASS && bashio::log.blue "ZM_DB_PASS=$ZM_DB_PASS" + + bashio::log.warning "Firefly-iii is using the Maria DB addon" + bashio::log.warning "Please ensure this is included in your backups" + bashio::log.warning "Uninstalling the MariaDB addon will remove any data" + + bashio::log.info "Creating database for Firefly-iii if required" + mysql \ + -u "${ZM_DB_USER}" -p"${ZM_DB_PASS}" \ + -h "${ZM_DB_HOST}" -P "${ZM_DB_PORT}" \ + -e "CREATE DATABASE IF NOT EXISTS \`firefly\` ;" + ;; + + # Use remote + external) + bashio::log.info "Using remote database. Requirement : filling all addon options fields, and making sure the database already exists" + for conditions in "ZM_DB_HOST" "ZM_DB_PORT" "ZM_DB_NAME" "ZM_DB_USER" "ZM_DB_PASS"; do + if ! bashio::config.has_value "$conditions"; then + bashio::exit.nok "Remote database has been specified but $conditions is not defined in addon options" + fi + done + ;; -# Use remote -*) - bashio::log.info "Using internal database" - ;; + # Use remote + *) + bashio::log.info "Using internal database" + ;; esac