mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-12 00:47:49 -04:00
hiby: r1_patcher: quote path variables
Change-Id: I5d03b4ecec1847c404a2f2400b648469023942e2
This commit is contained in:
parent
b056191e89
commit
db8494d4e0
1 changed files with 32 additions and 32 deletions
|
|
@ -12,39 +12,39 @@ fi
|
|||
### init
|
||||
################################################################################
|
||||
|
||||
currentdir=$(pwd)
|
||||
updatefile="$(basename $1)"
|
||||
currentdir="$(pwd)"
|
||||
updatefile="$(basename "$1")"
|
||||
updatefile_rb="${updatefile%.*}_rb.upt"
|
||||
|
||||
workingdir=$(realpath ./working_dir)
|
||||
workingdir_in=$workingdir"/in"
|
||||
workingdir_out=$workingdir"/out"
|
||||
workingdir="$(realpath ./working_dir)"
|
||||
workingdir_in="$workingdir/in"
|
||||
workingdir_out="$workingdir/out"
|
||||
|
||||
rm -rf $workingdir
|
||||
rm -rf "$workingdir"
|
||||
|
||||
mkdir $workingdir
|
||||
mkdir $workingdir_in
|
||||
mkdir $workingdir_out
|
||||
mkdir "$workingdir"
|
||||
mkdir "$workingdir_in"
|
||||
mkdir "$workingdir_out"
|
||||
|
||||
################################################################################
|
||||
### extract
|
||||
################################################################################
|
||||
|
||||
# extract iso
|
||||
mkdir -p $workingdir_in/image_contents
|
||||
7z -o$workingdir_in/image_contents x $updatefile
|
||||
mkdir -p "$workingdir_in/image_contents"
|
||||
7z -o"$workingdir_in/image_contents" x "$updatefile"
|
||||
|
||||
# create xImage (unchanged)
|
||||
mkdir -p $workingdir_out/xImage
|
||||
cat $workingdir_in/image_contents/ota_v0/xImage.* > $workingdir_out/xImage/xImage
|
||||
mkdir -p "$workingdir_out/xImage"
|
||||
cat "$workingdir_in/image_contents/ota_v0"/xImage.* > "$workingdir_out/xImage/xImage"
|
||||
|
||||
# create rootfs
|
||||
mkdir -p $workingdir_in/rootfs
|
||||
mkdir -p $workingdir_in/rootfs/extracted
|
||||
cat $workingdir_in/image_contents/ota_v0/rootfs.squashfs.* > $workingdir_in/rootfs/rootfs.squashfs
|
||||
mkdir -p "$workingdir_in/rootfs"
|
||||
mkdir -p "$workingdir_in/rootfs/extracted"
|
||||
cat "$workingdir_in/image_contents/ota_v0"/rootfs.squashfs.* > "$workingdir_in/rootfs/rootfs.squashfs"
|
||||
|
||||
# extract rootfs
|
||||
unsquashfs -f -d $workingdir_in/rootfs/extracted $workingdir_in/rootfs/rootfs.squashfs
|
||||
unsquashfs -f -d "$workingdir_in/rootfs/extracted" "$workingdir_in/rootfs/rootfs.squashfs"
|
||||
|
||||
################################################################################
|
||||
### update
|
||||
|
|
@ -55,15 +55,15 @@ cp "$2" "$workingdir_in/rootfs/extracted/usr/bin/bootloader.rb"
|
|||
chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/bootloader.rb"
|
||||
|
||||
# copy modified 'hibyplayer.sh' script
|
||||
cp hiby_player.sh $workingdir_in/rootfs/extracted/usr/bin/
|
||||
chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/hiby_player.sh
|
||||
cp hiby_player.sh "$workingdir_in/rootfs/extracted/usr/bin/"
|
||||
chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/hiby_player.sh"
|
||||
|
||||
################################################################################
|
||||
### Rockbox Hotplug Logic
|
||||
################################################################################
|
||||
|
||||
# 1. Create hotplug helper script
|
||||
cat << 'EOF' > $workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh
|
||||
cat << 'EOF' > "$workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh"
|
||||
#!/bin/sh
|
||||
MNT_SD="/data/mnt/sd_0"
|
||||
MNT_USB="/data/mnt/usb"
|
||||
|
|
@ -84,7 +84,7 @@ case "$ACTION" in
|
|||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod 0755 $workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh
|
||||
chmod 0755 "$workingdir_in/rootfs/extracted/usr/bin/rb_hotplug.sh"
|
||||
|
||||
# 2. Check mdev.conf and append rules only if missing
|
||||
MDEV_CONF="$workingdir_in/rootfs/extracted/etc/mdev.conf"
|
||||
|
|
@ -103,39 +103,39 @@ fi
|
|||
|
||||
mkdir -p "$workingdir_out/image_contents/ota_v0"
|
||||
|
||||
mksquashfs $workingdir_in/rootfs/extracted $workingdir_out/rootfs.squashfs -comp lzo -all-root
|
||||
mksquashfs "$workingdir_in/rootfs/extracted" "$workingdir_out/rootfs.squashfs" -comp lzo -all-root
|
||||
|
||||
cd "$workingdir_out/image_contents/ota_v0"
|
||||
|
||||
# rootfs.squashfs
|
||||
split -b 512k $workingdir_out/rootfs.squashfs --numeric-suffixes=0 -a 4 rootfs.squashfs.
|
||||
split -b 512k "$workingdir_out/rootfs.squashfs" --numeric-suffixes=0 -a 4 rootfs.squashfs.
|
||||
|
||||
rootfs_md5=($(md5sum $workingdir_out/rootfs.squashfs))
|
||||
rootfs_md5=($(md5sum "$workingdir_out/rootfs.squashfs"))
|
||||
rootfs_size=$(stat -c%s "$workingdir_out/rootfs.squashfs")
|
||||
md5=$rootfs_md5
|
||||
|
||||
ota_md5_rootfs="ota_md5_rootfs.squashfs.$md5"
|
||||
|
||||
for part in $(ls rootfs.squashfs.[0-9]* | sort); do
|
||||
md5next=($(md5sum $part))
|
||||
md5next=($(md5sum "$part"))
|
||||
echo $md5next >> $ota_md5_rootfs
|
||||
mv $part "$part.$md5"
|
||||
mv "$part" "$part.$md5"
|
||||
md5=$md5next
|
||||
done
|
||||
|
||||
# xImage
|
||||
split -b 512k $workingdir_out/xImage/xImage --numeric-suffixes=0 -a 4 xImage.
|
||||
split -b 512k "$workingdir_out/xImage/xImage" --numeric-suffixes=0 -a 4 xImage.
|
||||
|
||||
ximage_md5=($(md5sum $workingdir_out/xImage/xImage))
|
||||
ximage_md5=($(md5sum "$workingdir_out/xImage/xImage"))
|
||||
ximage_size=$(stat -c%s "$workingdir_out/xImage/xImage")
|
||||
md5=$ximage_md5
|
||||
|
||||
ota_md5_xImage="ota_md5_xImage.$md5"
|
||||
|
||||
for part in $(ls xImage.[0-9]* | sort); do
|
||||
md5next=($(md5sum $part))
|
||||
md5next=($(md5sum "$part"))
|
||||
echo $md5next >> $ota_md5_xImage
|
||||
mv $part "$part.$md5"
|
||||
mv "$part" "$part.$md5"
|
||||
md5=$md5next
|
||||
done
|
||||
|
||||
|
|
@ -162,12 +162,12 @@ cd "$workingdir_out/image_contents"
|
|||
echo "current_version=0" > ota_config.in
|
||||
|
||||
# iso
|
||||
genisoimage -f -U -J -joliet-long -r -allow-lowercase -allow-multidot -o $currentdir/$updatefile_rb $workingdir_out/image_contents/
|
||||
genisoimage -f -U -J -joliet-long -r -allow-lowercase -allow-multidot -o "$currentdir/$updatefile_rb" "$workingdir_out/image_contents/"
|
||||
|
||||
################################################################################
|
||||
### cleanup
|
||||
################################################################################
|
||||
|
||||
rm -rf $workingdir
|
||||
rm -rf "$workingdir"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue