A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1#!/bin/sh
2
3# The updater script on the NWZ has a major bug/feature:
4# it does NOT clear the update flag if the update scrit fails
5# thus causing a update/reboot loop and a bricked device
6# always clear to make sure we don't end up being screwed
7nvpflag fup 0xFFFFFFFF
8
9#
10# This script extracts the second file from the UPG to /tmp and runs it
11#
12
13
14# go to /tmp
15cd /tmp
16
17# get content partition path
18CONTENTS="/contents"
19CONTENTS_PART=`mount | grep contents | awk '{ print $1 }'`
20
21lcdmsg -c -f /usr/local/bin/font_08x12.bmp -l 0,3 "Contents partition:\n$CONTENTS_PART"
22
23# We need to remount the contents partition in read-write mode be able to
24# write something on it
25lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,6 "Remount $CONTENTS rw"
26if ! mount -o remount,rw $CONTENTS_PART $CONTENTS
27then
28 lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,7 "ERROR: remount failed"
29 sleep 3
30 exit 0
31fi
32
33# get update filename
34_UPDATE_FN_=`nvpstr ufn`
35# export model id
36export ICX_MODEL_ID=`/usr/local/bin/nvpflag -x mid`
37
38# extract second file
39fwpchk -f /contents/$_UPDATE_FN_.UPG -c -1 exec
40if [ "$?" != 0 ]; then
41 lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,7 "ERROR: no file to execute"
42 sleep 3
43 exit 0
44fi
45
46# make it executable
47chmod 755 exec
48if [ "$?" != 0 ]; then
49 lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,7 "ERROR: cannot make it executable"
50 sleep 3
51 exit 0
52fi
53
54# run it and redirect all outputs to exec.txt
55lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,7 "Running file..."
56/tmp/exec >$CONTENTS/exec.txt 2>&1
57
58# Success screen
59lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,15 "Rebooting in 3 seconds."
60sleep 3
61sync
62
63# finish
64exit 0