Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

hiby: r1_patcher: quote path variables

Change-Id: I5d03b4ecec1847c404a2f2400b648469023942e2

authored by

Roman Artiukhin and committed by
Solomon Peachy
db8494d4 b056191e

+32 -32
+32 -32
tools/r1_patcher/r1_patcher.sh
··· 12 12 ### init 13 13 ################################################################################ 14 14 15 - currentdir=$(pwd) 16 - updatefile="$(basename $1)" 15 + currentdir="$(pwd)" 16 + updatefile="$(basename "$1")" 17 17 updatefile_rb="${updatefile%.*}_rb.upt" 18 18 19 - workingdir=$(realpath ./working_dir) 20 - workingdir_in=$workingdir"/in" 21 - workingdir_out=$workingdir"/out" 19 + workingdir="$(realpath ./working_dir)" 20 + workingdir_in="$workingdir/in" 21 + workingdir_out="$workingdir/out" 22 22 23 - rm -rf $workingdir 23 + rm -rf "$workingdir" 24 24 25 - mkdir $workingdir 26 - mkdir $workingdir_in 27 - mkdir $workingdir_out 25 + mkdir "$workingdir" 26 + mkdir "$workingdir_in" 27 + mkdir "$workingdir_out" 28 28 29 29 ################################################################################ 30 30 ### extract 31 31 ################################################################################ 32 32 33 33 # extract iso 34 - mkdir -p $workingdir_in/image_contents 35 - 7z -o$workingdir_in/image_contents x $updatefile 34 + mkdir -p "$workingdir_in/image_contents" 35 + 7z -o"$workingdir_in/image_contents" x "$updatefile" 36 36 37 37 # create xImage (unchanged) 38 - mkdir -p $workingdir_out/xImage 39 - cat $workingdir_in/image_contents/ota_v0/xImage.* > $workingdir_out/xImage/xImage 38 + mkdir -p "$workingdir_out/xImage" 39 + cat "$workingdir_in/image_contents/ota_v0"/xImage.* > "$workingdir_out/xImage/xImage" 40 40 41 41 # create rootfs 42 - mkdir -p $workingdir_in/rootfs 43 - mkdir -p $workingdir_in/rootfs/extracted 44 - cat $workingdir_in/image_contents/ota_v0/rootfs.squashfs.* > $workingdir_in/rootfs/rootfs.squashfs 42 + mkdir -p "$workingdir_in/rootfs" 43 + mkdir -p "$workingdir_in/rootfs/extracted" 44 + cat "$workingdir_in/image_contents/ota_v0"/rootfs.squashfs.* > "$workingdir_in/rootfs/rootfs.squashfs" 45 45 46 46 # extract rootfs 47 - unsquashfs -f -d $workingdir_in/rootfs/extracted $workingdir_in/rootfs/rootfs.squashfs 47 + unsquashfs -f -d "$workingdir_in/rootfs/extracted" "$workingdir_in/rootfs/rootfs.squashfs" 48 48 49 49 ################################################################################ 50 50 ### update ··· 55 55 chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/bootloader.rb" 56 56 57 57 # copy modified 'hibyplayer.sh' script 58 - cp hiby_player.sh $workingdir_in/rootfs/extracted/usr/bin/ 59 - chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/hiby_player.sh 58 + cp hiby_player.sh "$workingdir_in/rootfs/extracted/usr/bin/" 59 + chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/hiby_player.sh" 60 60 61 61 ################################################################################ 62 62 ### Rockbox Hotplug Logic 63 63 ################################################################################ 64 64 65 65 # 1. Create hotplug helper script 66 - cat << 'EOF' > $workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh 66 + cat << 'EOF' > "$workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh" 67 67 #!/bin/sh 68 68 MNT_SD="/data/mnt/sd_0" 69 69 MNT_USB="/data/mnt/usb" ··· 84 84 ;; 85 85 esac 86 86 EOF 87 - chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh 87 + chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh" 88 88 89 89 # 2. Check mdev.conf and append rules only if missing 90 90 MDEV_CONF="$workingdir_in/rootfs/extracted/etc/mdev.conf" ··· 103 103 104 104 mkdir -p "$workingdir_out/image_contents/ota_v0" 105 105 106 - mksquashfs $workingdir_in/rootfs/extracted $workingdir_out/rootfs.squashfs -comp lzo -all-root 106 + mksquashfs "$workingdir_in/rootfs/extracted" "$workingdir_out/rootfs.squashfs" -comp lzo -all-root 107 107 108 108 cd "$workingdir_out/image_contents/ota_v0" 109 109 110 110 # rootfs.squashfs 111 - split -b 512k $workingdir_out/rootfs.squashfs --numeric-suffixes=0 -a 4 rootfs.squashfs. 111 + split -b 512k "$workingdir_out/rootfs.squashfs" --numeric-suffixes=0 -a 4 rootfs.squashfs. 112 112 113 - rootfs_md5=($(md5sum $workingdir_out/rootfs.squashfs)) 113 + rootfs_md5=($(md5sum "$workingdir_out/rootfs.squashfs")) 114 114 rootfs_size=$(stat -c%s "$workingdir_out/rootfs.squashfs") 115 115 md5=$rootfs_md5 116 116 117 117 ota_md5_rootfs="ota_md5_rootfs.squashfs.$md5" 118 118 119 119 for part in $(ls rootfs.squashfs.[0-9]* | sort); do 120 - md5next=($(md5sum $part)) 120 + md5next=($(md5sum "$part")) 121 121 echo $md5next >> $ota_md5_rootfs 122 - mv $part "$part.$md5" 122 + mv "$part" "$part.$md5" 123 123 md5=$md5next 124 124 done 125 125 126 126 # xImage 127 - split -b 512k $workingdir_out/xImage/xImage --numeric-suffixes=0 -a 4 xImage. 127 + split -b 512k "$workingdir_out/xImage/xImage" --numeric-suffixes=0 -a 4 xImage. 128 128 129 - ximage_md5=($(md5sum $workingdir_out/xImage/xImage)) 129 + ximage_md5=($(md5sum "$workingdir_out/xImage/xImage")) 130 130 ximage_size=$(stat -c%s "$workingdir_out/xImage/xImage") 131 131 md5=$ximage_md5 132 132 133 133 ota_md5_xImage="ota_md5_xImage.$md5" 134 134 135 135 for part in $(ls xImage.[0-9]* | sort); do 136 - md5next=($(md5sum $part)) 136 + md5next=($(md5sum "$part")) 137 137 echo $md5next >> $ota_md5_xImage 138 - mv $part "$part.$md5" 138 + mv "$part" "$part.$md5" 139 139 md5=$md5next 140 140 done 141 141 ··· 162 162 echo "current_version=0" > ota_config.in 163 163 164 164 # iso 165 - genisoimage -f -U -J -joliet-long -r -allow-lowercase -allow-multidot -o $currentdir/$updatefile_rb $workingdir_out/image_contents/ 165 + genisoimage -f -U -J -joliet-long -r -allow-lowercase -allow-multidot -o "$currentdir/$updatefile_rb" "$workingdir_out/image_contents/" 166 166 167 167 ################################################################################ 168 168 ### cleanup 169 169 ################################################################################ 170 170 171 - rm -rf $workingdir 171 + rm -rf "$workingdir" 172 172 173 173 exit 0