A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 54 lines 1.9 kB view raw
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 remounts the user (aka contents) partition read-write-exec and 11# runs the file given and redirects its output and error to a file. 12# To use this file, you need to replace NWZ_EXEC_THIS by the file you want to 13# execute and NWZ_LOG_THIS by the name of the file you want to log to. You may 14# use sed as follows for this purpose: 15# cat exec_file_extern.sh.in | sed 's|NWZ_EXEC_THIS|myfile.elf|' | \ 16# sed 's|NWZ_LOG_THIS|exec.log|' > my_exec_file.sh 17# 18# NOTE 1: technically, NWZ_EXEC_THIS can be any command, not just a file 19# NOTE 2: this script will export the variable NWZ_CONTENTS that is the path to 20# the user partition, so that if NWZ_EXEC_THIS is a bash script, it can 21# easily use it 22# 23 24# go to /tmp 25cd /tmp 26 27# get content partition path 28CONTENTS="/contents" 29CONTENTS_PART=`mount | grep contents | awk '{ print $1 }'` 30 31lcdmsg -c -f /usr/local/bin/font_08x12.bmp -l 0,3 "Contents partition:\n$CONTENTS_PART" 32 33# 2) We need to remount the contents partition in read-write mode be able to 34# write something on it 35lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,6 "Remount $CONTENTS rw and exec" 36if ! mount -o remount,rw,umask=000 $CONTENTS_PART $CONTENTS 37then 38 lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,7 "ERROR: remount failed" 39 sleep 3 40 exit 0 41fi 42 43# run file and redirect all outputs 44lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,7 "Running file..." 45export NWZ_CONTENTS="$CONTENTS" 46$CONTENTS/NWZ_EXEC_THIS >$CONTENTS/NWZ_LOG_THIS 2>&1 47 48# 4) Success screen 49lcdmsg -f /usr/local/bin/font_08x12.bmp -l 0,15 "Rebooting in 3 seconds." 50sleep 3 51sync 52 53# finish 54exit 0