diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-02-19 21:23:41 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-02-19 21:23:41 +0300 |
commit | e7bb56b084cd27b80ceec15ce71cbbd1ccfd5446 (patch) | |
tree | 943a4424ef0acc64fa24b6ca1a39bc5fc11b423a /mods/mod_hakchi/hakchi/rootfs/etc/preinit.d | |
parent | 8d31e86bdd82aa5f46bd24b3a6b5665e1b2796d8 (diff) |
Updated to latest hakchi, latest zImage, fixes
Diffstat (limited to 'mods/mod_hakchi/hakchi/rootfs/etc/preinit.d')
5 files changed, 41 insertions, 19 deletions
diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions index cb5c9e15..ec568dc8 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions @@ -77,7 +77,7 @@ remount_root(){ stopTask decodepng stopTask aplay - umount "$mountpoint" + umount "$mountpoint" || (mkdir -p "/var/fuckup" && mount --move "$mountpoint" "/var/fuckup") local loopfile="/var${1##$mountpoint/var}" [ -f "$loopfile" ] || loopfile="/media${1##$mountpoint/media}" @@ -254,8 +254,8 @@ softwareCheck(){ repair_fonts(){ if [ "$sftype" == "nes" ]; then mkdir -p "$1" || return 1 - [ ! -f "$1/title.fnt" ] && copy "$squashfs$gamepath/title.fnt" "$1/" - [ ! -f "$1/copyright.fnt" ] && copy "$squashfs$gamepath/copyright.fnt" "$1/" + [ ! -f "$1/title.fnt" ] && (copy "$rootfs$gamepath/title.fnt" "$1/" || copy "$squashfs$gamepath/title.fnt" "$1/") + [ ! -f "$1/copyright.fnt" ] && (copy "$rootfs$gamepath/copyright.fnt" "$1/" || copy "$squashfs$gamepath/copyright.fnt" "$1/") fi } @@ -335,7 +335,10 @@ overmount_games(){ local menu_code="$1" [ -z "$1" ] && menu_code="000" [ -z "$1" ] && [ -f "$state_file" ] && menu_code="$(cat "$state_file")" - containsGames "$gameStorage/$menu_code" || menu_code="" + if ! containsGames "$gameStorage/$menu_code"; then + menu_code="000" + containsGames "$gameStorage/$menu_code" || menu_code="" + fi echo "menu code: $menu_code" if containsGames "$gameStorage/$menu_code"; then mount_bind "$gameStorage/$menu_code" "$mountpoint/$gamepath" && \ diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0030_package b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0030_package index 3c3894f3..7697c6c7 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0030_package +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0030_package @@ -37,17 +37,23 @@ pack_upath(){ } pack_install(){ - echo "installing $(basename "$1" .hmod)..." - if [ -f "$1" ]; then + local packFile="$(readlink -f "$1")" + local packName="$(basename "$1" .hmod)" + echo "installing $packName..." + if [ -f "$packFile" ]; then local transferpath="$temppath/pack" rm -rf "$transferpath" mkdir -p "$transferpath" - cd "$transferpath" && tar -xzf "$1" + cd "$transferpath" && tar -xzf "$packFile" else - local transferpath="$1" + local transferpath="$packFile" fi transfer_path "$transferpath" - echo "creating uninstall for $(basename "$1" .hmod)..." + if grep -xqF "no-uninstall" "$transferpath/uninstall"; then + echo "package $packName installed" + return 0 + fi + echo "creating uninstall for $packName..." echo >> "$transferpath/uninstall" echo "# auto-generated" >> "$transferpath/uninstall" cd "$transferpath" @@ -56,7 +62,7 @@ pack_install(){ find . -depth -mindepth 1 -type d -exec echo rmdir \"\$rootfs/{}\" + >> "$transferpath/uninstall" [ $(stat -c%s "$transferpath/uninstall") -gt 8 ] || rm -f "$transferpath/uninstall" cd / - local unfile="$(pack_upath "$1")" + local unfile="$(pack_upath "$packFile")" if [ -f "$transferpath/uninstall" ]; then dos2unix -u "$transferpath/uninstall" sed -i "s#rmdir #rmdir --ignore-fail-on-non-empty #" "$transferpath/uninstall" @@ -65,7 +71,7 @@ pack_install(){ else rm -f "$unfile" fi - echo "package $(basename "$1" .hmod) installed" + echo "package $packName installed" } pack_list(){ @@ -84,10 +90,11 @@ pack_uninstall(){ else local unfile="$(pack_upath "$1")" if [ -f "$unfile" ]; then - echo "uninstalling $(basename "$1" .hmod)..." + local packName="$(basename "$1" .hmod)" + echo "uninstalling $packName..." cd "$rootfs" transfer_file "$unfile" - echo "package $(basename "$1" .hmod) uninstalled" + echo "package $packName uninstalled" fi fi cd / diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb index ddfffdb4..3abecd6f 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0040_usb @@ -30,25 +30,33 @@ getUsbStorageIds(){ done } -waitForUsbDevice(){ - [ -z "$(getUsbStorageIds)" ] && return 1 +waitForStorageDevice(){ local blockDevice="$1" - local timeout=5 + [ -z "$timeout" ] && local timeout=5 while [ $timeout -gt 0 ] && ! [ -b "$blockDevice" ]; do - echo "waiting for media $timeout" + echo "waiting for $blockDevice $timeout" let timeout=timeout-1 sleep 1 done [ -b "$blockDevice" ] } +waitForUsbDevice(){ + [ -z "$(getUsbStorageIds)" ] && return 1 + waitForStorageDevice ${1+"$@"} +} + +waitForMmcDevice(){ + [ -f "/key-file" ] && return 1 + waitForStorageDevice ${1+"$@"} +} + checkStorageDevice(){ local blockDevice="$1" [ -b "$blockDevice" ] || return 1 local ro="defaults,nosuid,nodev,noatime,ro" local rw="defaults,nosuid,nodev,noatime,rw" - local games="$modname/games" local saves="$modname/saves" if ! [ "$cfg_usb_rw" == "y" ]; then @@ -98,6 +106,7 @@ checkExtStorage(){ local di local d local p + local timeout=5 local blockDevice="/dev/sd" waitForUsbDevice "${blockDevice}a1" for di in $(seq 97 99); do @@ -106,7 +115,9 @@ checkExtStorage(){ checkStorageDevice "$blockDevice$d$p" && return 0 done done + [ $timeout -gt 2 ] && timeout=2 blockDevice="/dev/mmcblk0p" + waitForMmcDevice "${blockDevice}1" for p in $(seq 1 9); do checkStorageDevice "$blockDevice$p" && return 0 done diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb index 43b27c24..8c38f151 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7020_usb @@ -4,7 +4,7 @@ else switchToUsbHost # the usb driver needs some time to initialize sleep 1 - if [ -z "$(lsusb | grep -v "1d6b:0001")" ]; then + if [ -z "$(lsusb | grep -v "1d6b:")" ]; then switchToUsbDevice fi fi diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7100_preinit b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7100_preinit index 7110dfb9..9fa94f93 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7100_preinit +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/p7100_preinit @@ -1,2 +1,3 @@ +createVersionFile overmount "/bin" overmount "/etc" |