Skip to content

Instantly share code, notes, and snippets.

@queeup
Created November 9, 2019 21:02
Show Gist options
  • Save queeup/f72ae6a23024b0d902f128cd7af4f1a3 to your computer and use it in GitHub Desktop.
Save queeup/f72ae6a23024b0d902f128cd7af4f1a3 to your computer and use it in GitHub Desktop.
LibreELEC/OpenELEC autostart.sh
#!/bin/sh
## https://wiki.libreelec.tv/autostart.sh
## https://wiki.libreelec.tv/useful_shell_scripts
### For my phillips tv remote
(
logger -t "autostart.sh" "### loading remote control user keytable ###"
ir-keytable -c > /dev/null 2>&1;
ir-keytable -w /storage/.config/rc_keymaps/phillips > /dev/null 2>&1;
) &
### for restart sshd with my options
(
SSHDCONF=$HOME/.cache/services/sshd.conf
if [ -f $SSHDCONF ]; then
logger -t "autostart.sh" "### sshd.service restarting with user args ###"
# if I add this options, libreelec sshd refusing my connections
# -o 'GSSAPIAuthentication no' -o 'GSSAPIDelegateCredentials yes' -o 'ChallengeResponseAuthentication no' -o 'KerberosAuthentication no'
sed -e "s|^SSH_ARGS.*|SSH_ARGS=\"-o 'PasswordAuthentication no' -o 'UseDNS no' -o 'X11Forwarding no'\"|g" \
-i $SSHDCONF
systemctl restart sshd
fi
) &
### For adjusting network mtu
(
if [ `systemctl is-active network.target` == "active" ]; then
logger -t "autostart.sh" "### adjusting wlan0 mtu to 1492 ###"
ifconfig wlan0 mtu 1492
# ip link set wlan0 mtu 1492
fi
) &
### publish webui's
(
## Transmission BT
while ! systemctl -q is-active docker.linuxserver.transmission.service
do
sleep 1
if (systemctl -q is-active docker.linuxserver.transmission.service)
then
break
fi
done
logger -t "autostart.sh" "### Publishing Transmission WebUI with avahi ###"
/storage/bin/avahi-publish -s "Transmission WebUI (LibreELEC)" _http._tcp 9091 > /dev/null 2>&1 &
## Couchpotato
while ! systemctl -q is-active docker.linuxserver.couchpotato.service
do
sleep 1
if (systemctl -q is-active docker.linuxserver.couchpotato.service)
then
break
fi
done
logger -t "autostart.sh" "### Publishing Couchpotato WebUI with avahi ###"
/storage/bin/avahi-publish -s "Couchpotato WebUI (LibreELEC)" _http._tcp 5050 > /dev/null 2>&1 &
## Sonarr
while ! systemctl -q is-active docker.linuxserver.sonarr.service
do
sleep 1
if (systemctl -q is-active docker.linuxserver.sonarr.service)
then
break
fi
done
logger -t "autostart.sh" "### Publishing Sonarr WebUI with avahi ###"
/storage/bin/avahi-publish -s "Sonarr WebUI (LibreELEC)" _http._tcp 8989 > /dev/null 2>&1 &
) &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment