Hi, few months ago I did an official request here: https://github.com/MichaIng/DietPi/discussions/5571
And today I tried to make functional all the scritps necessary for adding it to DietPi if possible.
I just need some help because I have very low codding knowledge
Install script:
#!/bin/bash
curl -L https://github.com/tananaev/traccar/releases/download/v5.5/traccar-linux-arm-5.5.zip > traccar.zip
unzip traccar.zip
rm traccar.zip
sudo ./traccar.run
#apt install default-jre-headless (it would be necessary to dietpi to install that package on this step if arm64 is detected)
rm /opt/traccar/jre/bin/java
ln -s /usr/lib/jvm/java-17-openjdk-arm64/bin/java /opt/traccar/jre/bin/java
#run as non root user
useradd traccar
chown -R traccar:traccar /opt/traccar
mkdir /etc/systemd/system/traccar.service.d/
touch /etc/systemd/system/traccar.service.d/run-as-user.conf
cat > /etc/systemd/system/traccar.service.d/run-as-user.conf <<EOF
[Service]
User=traccar
Group=traccar
EOF
systemctl start traccar
Here as I put on the comments, it would be necessary to add the instalation of package 196 for those systems running arm64, if not these line are not necessary:
rm /opt/traccar/jre/bin/java
ln -s /usr/lib/jvm/java-17-openjdk-arm64/bin/java /opt/traccar/jre/bin/java
Update script:
#!/bin/bash
systemctl stop traccar
#make a backup of database files on /opt/traccar/data and config files on /opt/traccar/conf, I make this with the copy of dietpi-backup overwriting files
rm /opt/traccar
#get latest release
curl -sL $(curl -s https://api.github.com/repos/traccar/traccar/releases/latest | grep browser_download_url | cut -d\" -f4 | egrep 'linux-arm-[0-9.]+zip$') >traccar.zip
unzip traccar.zip
rm traccar.zip
sudo ./traccar.run
#apt install default-jre-headless (it would be necessary to dietpi to install that package on this step if arm64 is detected)
chown -R traccar:traccar /opt/traccar
rm /opt/traccar/jre/bin/java
ln -s /usr/bin/java /opt/traccar/jre/bin/java
systemctl start traccar
Uninstall script:
systemctl stop traccar
#Remove systemd service
systemctl disable traccar
rm /etc/systemd/system/traccar.service
systemctl daemon-reload
#Remove traccar user
deluser traccar
#Remove traccar directory
rm -R /opt/traccar
It would be needed to change this:
curl -L https://github.com/tananaev/traccar/releases/download/v5.5/traccar-linux-arm-5.5.zip > traccar.zip
To something that gets dinamically the latest release, and not the number version.
What do you think? Is it possible?
I’m sure you can improve it a lot…
Just wanted to help the community.
Regards.