mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-04-15 20:08:01 +02:00
Github bot : script beautyshied
This commit is contained in:
@@ -31,7 +31,7 @@ if bashio::config.has_value 'localdisks'; then
|
||||
# Mount as uuid
|
||||
if [ ${#disk} == 36 ] ; then
|
||||
devpath=/dev/disk/by-uuid
|
||||
# Mount as label
|
||||
# Mount as label
|
||||
elif [ "${disk:0:2}" != "sd" ] && [ "${disk:0:4}" != "nvme" ] ; then
|
||||
devpath=/dev/disk/by-label
|
||||
fi
|
||||
|
||||
@@ -106,7 +106,7 @@ for f in */; do
|
||||
)
|
||||
|
||||
[ "${BETA}" = true ] && \
|
||||
LASTVERSION=$(
|
||||
LASTVERSION=$(
|
||||
curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=$LISTSIZE" |
|
||||
jq '.results | .[] | .name' -r |
|
||||
sed -e '/.*latest.*/d' |
|
||||
@@ -116,7 +116,7 @@ for f in */; do
|
||||
)
|
||||
|
||||
[ "${BYDATE}" = true ] && \
|
||||
LASTVERSION=$(curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated" |
|
||||
LASTVERSION=$(curl -f -L -s --fail "https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/${DOCKERHUB_IMAGE}/tags/?page_size=${LISTSIZE}&ordering=last_updated" |
|
||||
jq '.results | .[] | .name' -r |
|
||||
sed -e '/.*latest.*/d' |
|
||||
sed -e '/.*dev.*/d' |
|
||||
@@ -129,7 +129,7 @@ for f in */; do
|
||||
) && \
|
||||
DATE="${DATE%T*}" && \
|
||||
LASTVERSION="$LASTVERSION-$DATE"
|
||||
LOGINFO="... $SLUG : bydate is true, version is $LASTVERSION" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
|
||||
LOGINFO="... $SLUG : bydate is true, version is $LASTVERSION" && if [ "$VERBOSE" = true ]; then bashio::log.info "$LOGINFO"; fi
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -3,32 +3,32 @@
|
||||
|
||||
for file in /data/gitea/conf/app.ini /etc/templates/app.ini; do
|
||||
|
||||
if [ ! -f "$file" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ ! -f "$file" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
##############
|
||||
# SSL CONFIG #
|
||||
##############
|
||||
##############
|
||||
# SSL CONFIG #
|
||||
##############
|
||||
|
||||
# Clean values
|
||||
sed -i "/PROTOCOL/d" "$file"
|
||||
sed -i "/CERT_FILE/d" "$file"
|
||||
sed -i "/KEY_FILE/d" "$file"
|
||||
# Clean values
|
||||
sed -i "/PROTOCOL/d" "$file"
|
||||
sed -i "/CERT_FILE/d" "$file"
|
||||
sed -i "/KEY_FILE/d" "$file"
|
||||
|
||||
# Add ssl
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
PROTOCOL=https
|
||||
bashio::log.info "ssl is enabled"
|
||||
sed -i "/server/a PROTOCOL=https" "$file"
|
||||
sed -i "/server/a CERT_FILE=/ssl/$(bashio::config 'certfile')" "$file"
|
||||
sed -i "/server/a KEY_FILE=/ssl/$(bashio::config 'keyfile')" "$file"
|
||||
chmod 744 /ssl/*
|
||||
else
|
||||
PROTOCOL=http
|
||||
sed -i "/server/a PROTOCOL=http" "$file"
|
||||
fi
|
||||
# Add ssl
|
||||
bashio::config.require.ssl
|
||||
if bashio::config.true 'ssl'; then
|
||||
PROTOCOL=https
|
||||
bashio::log.info "ssl is enabled"
|
||||
sed -i "/server/a PROTOCOL=https" "$file"
|
||||
sed -i "/server/a CERT_FILE=/ssl/$(bashio::config 'certfile')" "$file"
|
||||
sed -i "/server/a KEY_FILE=/ssl/$(bashio::config 'keyfile')" "$file"
|
||||
chmod 744 /ssl/*
|
||||
else
|
||||
PROTOCOL=http
|
||||
sed -i "/server/a PROTOCOL=http" "$file"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
@@ -37,11 +37,11 @@ done
|
||||
##################
|
||||
|
||||
if bashio::config.true 'ROOT_URL'; then
|
||||
bashio::log.blue "ROOT_URL set, using value : $(bashio::config 'ROOT_URL')"
|
||||
bashio::log.blue "ROOT_URL set, using value : $(bashio::config 'ROOT_URL')"
|
||||
else
|
||||
ROOT_URL="$PROTOCOL://$(bashio::config 'DOMAIN'):$(bashio::addon.port 3000)"
|
||||
bashio::log.blue "ROOT_URL not set, using extrapolated value : $ROOT_URL"
|
||||
sed -i "/server/a ROOT_URL=$ROOT_URL" "$file"
|
||||
ROOT_URL="$PROTOCOL://$(bashio::config 'DOMAIN'):$(bashio::addon.port 3000)"
|
||||
bashio::log.blue "ROOT_URL not set, using extrapolated value : $ROOT_URL"
|
||||
sed -i "/server/a ROOT_URL=$ROOT_URL" "$file"
|
||||
fi
|
||||
|
||||
####################
|
||||
@@ -49,18 +49,18 @@ fi
|
||||
####################
|
||||
|
||||
for param in APP_NAME DOMAIN ROOT_URL; do
|
||||
# Remove parameter
|
||||
sed -i "/$param/d" "$file"
|
||||
# Remove parameter
|
||||
sed -i "/$param/d" "$file"
|
||||
|
||||
# Define parameter
|
||||
if bashio::config.has_value "$param"; then
|
||||
echo "parameter set : $param=$(bashio::config "$param")"
|
||||
sed -i "/server/a $param = \"$(bashio::config "$param")\"" "$file"
|
||||
# Define parameter
|
||||
if bashio::config.has_value "$param"; then
|
||||
echo "parameter set : $param=$(bashio::config "$param")"
|
||||
sed -i "/server/a $param = \"$(bashio::config "$param")\"" "$file"
|
||||
|
||||
# Allow at setup
|
||||
sed -i "1a $param=\"$(bashio::config "$param")\"" /etc/s6/gitea/setup
|
||||
# Allow at setup
|
||||
sed -i "1a $param=\"$(bashio::config "$param")\"" /etc/s6/gitea/setup
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ CONFIGSOURCE="/config/addons_config/omada"
|
||||
|
||||
# Use ssl
|
||||
if [ -d /ssl ]; then
|
||||
mkdir -p /cert
|
||||
cp /ssl/* /cert
|
||||
chown -R 508:508 /cert
|
||||
mkdir -p /cert
|
||||
cp /ssl/* /cert
|
||||
chown -R 508:508 /cert
|
||||
fi
|
||||
|
||||
# Create directory
|
||||
|
||||
@@ -19,35 +19,35 @@ change_folders () {
|
||||
|
||||
# Inform
|
||||
bashio::log.info "Setting $TYPE to $CONFIGLOCATION"
|
||||
|
||||
|
||||
if [ "$CONFIGLOCATION" != "$ORIGINALLOCATION" ]; then
|
||||
|
||||
# Modify files
|
||||
echo "Adapting files"
|
||||
grep -rl "$ORIGINALLOCATION" /etc/cont-init.d | xargs sed -i "s|$ORIGINALLOCATION|$CONFIGLOCATION|g" || true
|
||||
grep -rl "$ORIGINALLOCATION" /etc/services.d | xargs sed -i "s|$ORIGINALLOCATION|$CONFIGLOCATION|g" || true
|
||||
sed -i "s=$ORIGINALLOCATION=$CONFIGLOCATION=g" /etc/cont-init.d/10-adduser || true
|
||||
sed -i "s=$ORIGINALLOCATION=$CONFIGLOCATION=g" /defaults/* || true
|
||||
# Modify files
|
||||
echo "Adapting files"
|
||||
grep -rl "$ORIGINALLOCATION" /etc/cont-init.d | xargs sed -i "s|$ORIGINALLOCATION|$CONFIGLOCATION|g" || true
|
||||
grep -rl "$ORIGINALLOCATION" /etc/services.d | xargs sed -i "s|$ORIGINALLOCATION|$CONFIGLOCATION|g" || true
|
||||
sed -i "s=$ORIGINALLOCATION=$CONFIGLOCATION=g" /etc/cont-init.d/10-adduser || true
|
||||
sed -i "s=$ORIGINALLOCATION=$CONFIGLOCATION=g" /defaults/* || true
|
||||
|
||||
# Adapt sync.conf
|
||||
for FILE in "$ORIGINALLOCATION/sync.conf" "$CONFIGLOCATION/sync.conf" "/defaults/sync.conf"; do
|
||||
if [ "$TYPE" = "config_location" ]; then
|
||||
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.storage_path = $variable' "$FILE" | sponge "$FILE"
|
||||
fi
|
||||
if [ "$TYPE" = "data_location" ]; then
|
||||
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.directory_root = $variable' "$FILE" | sponge "$FILE"
|
||||
fi
|
||||
if [ "$TYPE" = "downloads_location" ]; then
|
||||
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.files_default_path = $variable' "$FILE" | sponge "$FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
# Transfer files
|
||||
if [ -d "$ORIGINALLOCATION" ] && [ "$(ls -A "$ORIGINALLOCATION" 2>/dev/null)" ]; then
|
||||
echo "Files were existing in $ORIGINALLOCATION, they will be moved to $CONFIGLOCATION"
|
||||
mv "$ORIGINALLOCATION"/* "$CONFIGLOCATION"/
|
||||
rmdir "$ORIGINALLOCATION"
|
||||
fi 2>/dev/null || true
|
||||
# Adapt sync.conf
|
||||
for FILE in "$ORIGINALLOCATION/sync.conf" "$CONFIGLOCATION/sync.conf" "/defaults/sync.conf"; do
|
||||
if [ "$TYPE" = "config_location" ]; then
|
||||
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.storage_path = $variable' "$FILE" | sponge "$FILE"
|
||||
fi
|
||||
if [ "$TYPE" = "data_location" ]; then
|
||||
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.directory_root = $variable' "$FILE" | sponge "$FILE"
|
||||
fi
|
||||
if [ "$TYPE" = "downloads_location" ]; then
|
||||
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.files_default_path = $variable' "$FILE" | sponge "$FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
# Transfer files
|
||||
if [ -d "$ORIGINALLOCATION" ] && [ "$(ls -A "$ORIGINALLOCATION" 2>/dev/null)" ]; then
|
||||
echo "Files were existing in $ORIGINALLOCATION, they will be moved to $CONFIGLOCATION"
|
||||
mv "$ORIGINALLOCATION"/* "$CONFIGLOCATION"/
|
||||
rmdir "$ORIGINALLOCATION"
|
||||
fi 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Create folders
|
||||
|
||||
Reference in New Issue
Block a user