Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibreELEC 10 Compatibility #6

Merged
merged 3 commits into from Oct 31, 2023
Merged

LibreELEC 10 Compatibility #6

merged 3 commits into from Oct 31, 2023

Conversation

skinlayers
Copy link

@skinlayers skinlayers commented Jun 15, 2022

Convert bash scripts to be POSIX compatible.
LibreELEC is based on busybox, so bash is actually an alias for ash on that platform.
ash doesn't support bare double-parenthesis for arithmetic evaluations, so they've been replaced with '[' (aka 'test') evaluations.

LibreELEC also use some different paths for SD card storage and additional python libraries. The sed commands below perform the appropriate edits, but these changes could be implemented directly with some conditional statements.

LibreELEC 10.0 instructions:

#Preference (gear icon) -> LibreELEC -> Services -> Enable SSH
#Preference (gear icon) -> Add-ons -> Install from repository -> LibreELEC Add-ons -> Program Add-ons -> Install System Tools and Raspberry Pi Tools

ssh root@X.X.X.X

mount -o remount,rw /flash
echo 'dtparam=i2c_arm=on' >> /flash/config.txt
mount -o remount,ro /flash

cd /tmp
curl -o ups-hat-main.tar.gz -L https://github.com/skinlayers/ups-hat/archive/refs/heads/main.tar.gz
tar xf ups-hat-main.tar.gz
cd ups-hat-main

cp systemd/hipi-io-ups-hat.service /storage/.config/system.d/
sed -i 's|ExecStart=/usr/local|ExecStart=/storage/.ups|' /storage/.config/system.d/hipi-io-ups-hat.service

mkdir -p /storage/.ups/sbin
cp -v scripts/ups.sh /storage/.ups/sbin/hipi-io-ups-hat-service
cp -v scripts/ups-set.py /storage/.ups/sbin/hipi-io-ups-hat-gpio-set
cp -v scripts/ups-reset.py /storage/.ups/sbin/hipi-io-ups-hat-gpio-reset

sed -i 's|/usr/local|/storage/.ups|g' /storage/.ups/sbin/hipi-io-ups-hat-service

sed -i "/^import sys$/a sys.path.append('\/storage\/.kodi\/addons\/virtual.rpi-tools\/lib')" /storage/.ups/sbin/hipi-io-ups-hat-gpio-set
sed -i "/^import sys$/a sys.path.append('\/storage\/.kodi\/addons\/virtual.rpi-tools\/lib')" /storage/.ups/sbin/hipi-io-ups-hat-gpio-reset

chmod +x /storage/.ups/sbin/hipi-io-ups-hat-service
chmod +x /storage/.ups/sbin/hipi-io-ups-hat-gpio-set
chmod +x /storage/.ups/sbin/hipi-io-ups-hat-gpio-reset

systemctl daemon-reload

systemctl enable hipi-io-ups-hat.service --no-pager
systemctl start hipi-io-ups-hat.service --no-pager

echo "Service hipi-io-ups-hat.service should be active!"
systemctl status hipi-io-ups-hat.service --no-pager

@Martin-HiPi
Copy link
Collaborator

Hi @skinlayers,

Thanks for the PR! I'll check it out and merge it when I have the time to do so, hopefully soon!

@Martin-HiPi Martin-HiPi merged commit 75c7b1c into hipi-io:main Oct 31, 2023
Copy link
Collaborator

@Martin-HiPi Martin-HiPi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants