Skip to content

Commit

Permalink
Merge pull request #446 from kdknigga/master
Browse files Browse the repository at this point in the history
convert from sysv init to systemd for the crash recovery benefits. Fixes #445.
  • Loading branch information
cyoung authored Jun 22, 2016
2 parents 6dd6432 + 29c6787 commit 5b99889
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
16 changes: 16 additions & 0 deletions __lib__systemd__system__stratux.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Stratux
After=network.target

[Service]
ExecStartPre=/root/stratux-pre-start.sh
ExecStart=/usr/bin/gen_gdl90
ExecStop=pkill dump1090
KillMode=process
Restart=always
RestartSec=5
LimitCORE=1073741824

[Install]
WantedBy=multi-user.target

17 changes: 17 additions & 0 deletions __root__stratux-pre-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

echo powersave >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Check if we need to run an update.
if [ -e /root/update*stratux*v*.sh ] ; then
UPDATE_SCRIPT=`ls -1t /root/update*stratux*v*.sh | head -1`
if [ -n "$UPDATE_SCRIPT" ] ; then
# Execute the script, remove it, then reboot.
echo
echo "Running update script ${UPDATE_SCRIPT}..."
sh ${UPDATE_SCRIPT}
rm -f $UPDATE_SCRIPT
reboot
fi
fi

3 changes: 2 additions & 1 deletion selfupdate/makeupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ mkdir -p work/bin
cp gen_gdl90 work/bin/
cp libdump978.so work/bin/
cp linux-mpu9150/libimu.so work/bin/
cp init.d-stratux work/bin/
cp __lib__systemd__system__stratux.service work/bin/
cp __root__stratux-pre-start.sh work/bin/
cp dump1090/dump1090 work/bin/
cp -r web work/bin/
cp image/hostapd.conf work/bin/
Expand Down
13 changes: 9 additions & 4 deletions selfupdate/update_footer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ cp -f libimu.so /usr/lib/libimu.so


# Startup script.
cp -f init.d-stratux /etc/init.d/stratux
chmod 755 /etc/init.d/stratux
ln -fs /etc/init.d/stratux /etc/rc2.d/S01stratux
ln -fs /etc/init.d/stratux /etc/rc6.d/K01stratux
rm -f /etc/init.d/stratux
rm -f /etc/rc2.d/S01stratux
rm -f /etc/rc6.d/K01stratux

cp -f __lib__systemd__system__stratux.service /lib/systemd/system/stratux.service
cp -f __root__stratux-pre-start.sh /root/stratux-pre-start.sh
chmod 644 /lib/systemd/system/stratux.service
chmod 744 /root/stratux-pre-start.sh
ln -fs /lib/systemd/system/stratux.service /etc/systemd/system/multi-user.target.wants/stratux.service

#wifi config
cp -f hostapd.conf /etc/hostapd/hostapd.conf
Expand Down

0 comments on commit 5b99889

Please sign in to comment.