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