Github bot : script beautyshied

This commit is contained in:
github-actions
2023-02-19 00:13:41 +00:00
parent a37eabf3db
commit a2e2c25aa4
2 changed files with 28 additions and 28 deletions

View File

@@ -25,45 +25,45 @@ if bashio::config.has_value 'localdisks'; then
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
# Creates dir # Creates dir
mkdir -p /mnt/"$disk" mkdir -p /mnt/"$disk"
chown "$PUID:$PGID" /mnt/"$disk" chown "$PUID:$PGID" /mnt/"$disk"
# Install lsblk # Install lsblk
if ! command -v "lsblk" &>/dev/null; then if ! command -v "lsblk" &>/dev/null; then
if command -v "apk" &>/dev/null; then apk add --no-cache lsblk; fi if command -v "apk" &>/dev/null; then apk add --no-cache lsblk; fi
if command -v "apt" &>/dev/null; then apt-get update && apt-get install -yqq util-linux; fi if command -v "apt" &>/dev/null; then apt-get update && apt-get install -yqq util-linux; fi
fi fi
# Check FS type and set relative options (thanks @https://github.com/dianlight/hassio-addons) # Check FS type and set relative options (thanks @https://github.com/dianlight/hassio-addons)
fstype=$(lsblk "$devpath"/"$disk" -no fstype) fstype=$(lsblk "$devpath"/"$disk" -no fstype)
options="nosuid,relatime,noexec" options="nosuid,relatime,noexec"
type="auto" type="auto"
bashio::log.info "Mounting ${disk} of type ${fstype}" bashio::log.info "Mounting ${disk} of type ${fstype}"
case "$fstype" in case "$fstype" in
exfat | vfat | msdos) exfat | vfat | msdos)
bashio::log.warning "${fstype} permissions and ACL don't works and this is an EXPERIMENTAL support" bashio::log.warning "${fstype} permissions and ACL don't works and this is an EXPERIMENTAL support"
options="${options},umask=000" options="${options},umask=000"
;; ;;
ntfs) ntfs)
bashio::log.warning "${fstype} is an EXPERIMENTAL support" bashio::log.warning "${fstype} is an EXPERIMENTAL support"
options="${options},umask=000" options="${options},umask=000"
type="ntfs" type="ntfs"
;; ;;
*) *)
if bashio::config.has_value 'PUID' && bashio::config.has_value 'PGID'; then if bashio::config.has_value 'PUID' && bashio::config.has_value 'PGID'; then
echo "Using PUID $(bashio::config 'PUID') and PGID $(bashio::config 'PGID')" echo "Using PUID $(bashio::config 'PUID') and PGID $(bashio::config 'PGID')"
options="$options,uid=$(bashio::config 'PUID'),gid=$(bashio::config 'PGID')" options="$options,uid=$(bashio::config 'PUID'),gid=$(bashio::config 'PGID')"
fi fi
;; ;;
esac esac
# Legacy mounting : mount to share if still exists (avoid breaking changes) # Legacy mounting : mount to share if still exists (avoid breaking changes)
dirpath="/mnt" dirpath="/mnt"
if [ -d /share/"$disk" ]; then dirpath="/share"; fi if [ -d /share/"$disk" ]; then dirpath="/share"; fi
# shellcheck disable=SC2015 # shellcheck disable=SC2015
mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" || \ mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" || \
(bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk)

View File

@@ -25,20 +25,20 @@ if bashio::config.has_value 'customUI' && [ ! "$CUSTOMUI" = default ] && [ ! "$C
"transmission-web-control") "transmission-web-control")
mkdir -p /tmp/twctemp && \ mkdir -p /tmp/twctemp && \
TWCVERSION=$(curl -s "https://api.github.com/repos/ronggang/transmission-web-control/releases/latest" | jq -r .tag_name) TWCVERSION=$(curl -s "https://api.github.com/repos/ronggang/transmission-web-control/releases/latest" | jq -r .tag_name)
curl -o /tmp/twc.tar.gz -L "https://github.com/ronggang/transmission-web-control/archive/${TWCVERSION}.tar.gz" curl -o /tmp/twc.tar.gz -L "https://github.com/ronggang/transmission-web-control/archive/${TWCVERSION}.tar.gz"
tar xf /tmp/twc.tar.gz -C /tmp/twctemp --strip-components=1 tar xf /tmp/twc.tar.gz -C /tmp/twctemp --strip-components=1
mv /tmp/twctemp/src /transmission-web-control mv /tmp/twctemp/src /transmission-web-control
# Enables the original UI button in transmission-web-control # Enables the original UI button in transmission-web-control
ln -s /usr/share/transmission/web/style /transmission-web-control && \ 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/images /transmission-web-control && \
ln -s /usr/share/transmission/web/javascript /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 ln -s /usr/share/transmission/web/index.html /transmission-web-control/index.original.html
;; ;;
"kettu") "kettu")
mkdir -p /kettu && \ mkdir -p /kettu && \
curl -o /tmp/kettu.tar.gz -L "https://github.com/endor/kettu/archive/master.tar.gz" curl -o /tmp/kettu.tar.gz -L "https://github.com/endor/kettu/archive/master.tar.gz"
tar xf /tmp/kettu.tar.gz -C /kettu --strip-components=1 tar xf /tmp/kettu.tar.gz -C /kettu --strip-components=1
;; ;;