Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-14 06:19:08 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-14 06:19:08 +0300
commit05faef4b7b56ed916bf187fe2326dc325c87d544 (patch)
tree8aa7604acfa4ceacb5a96c5e1f832e2b281eb733
parentea16dad67e4fb33d5fef52bbe733fbb18674af3d (diff)
Bugfixes and optimization
-rw-r--r--mod/hakchi/rootfs/usr/bin/chmenu26
-rw-r--r--mod/hakchi/script/package110
2 files changed, 81 insertions, 55 deletions
diff --git a/mod/hakchi/rootfs/usr/bin/chmenu b/mod/hakchi/rootfs/usr/bin/chmenu
new file mode 100644
index 0000000..e2023cd
--- /dev/null
+++ b/mod/hakchi/rootfs/usr/bin/chmenu
@@ -0,0 +1,26 @@
+#!/bin/sh
+installpath=/var/lib/hakchi
+rootfs=$installpath/rootfs
+gamesdir=$rootfs/usr/share/games/nes/kachikachi
+state_file=$installpath/menu
+echo Switching to menu $1
+echo $1>$state_file
+if [ "$1" == "000" ]; then
+ targetdir=$gamesdir
+else
+ targetdir=$gamesdir/$1
+fi
+echo New directory: $targetdir
+if [ ! -f $targetdir/title.fnt ]; then
+ ln -s $gamesdir/title.fnt $targetdir/title.fnt
+fi
+if [ ! -f $targetdir/copyright.fnt ]; then
+ ln -s $gamesdir/copyright.fnt $targetdir/copyright.fnt
+fi
+
+pkill -KILL clover-mcp
+pkill -KILL ReedPlayer-Clover
+
+umount -f /usr/share/games/nes/kachikachi
+mount -o bind $targetdir /usr/share/games/nes/kachikachi
+clover-mcp
diff --git a/mod/hakchi/script/package b/mod/hakchi/script/package
index e42c201..a5e0b7d 100644
--- a/mod/hakchi/script/package
+++ b/mod/hakchi/script/package
@@ -1,88 +1,88 @@
transfer_file(){
- [ -f "$1" ] || return 1
- source "$1"
- return $?
+ [ -f "$1" ] || return 1
+ source "$1"
+ return $?
}
transfer_default(){
sourcepath=$1
- rsync -ac --exclude "/uninstall" "$sourcepath/" "$installpath/"
+ rsync -ac --exclude "/uninstall" "$sourcepath/" "$installpath/"
}
transfer_path(){
[ -d "$1" ] || return 1
- trpath=$1
- transferfile=$trpath/transfer
- [ -f "$transferfile" ] && rm -f "$trpath/install"
- [ -f "$transferfile" ] || transferfile=$trpath/install
- rm -f $trpath/readme.*
- rm -f $trpath/README.*
- rm -f $trpath/*.txt
- rm -f $trpath/*.md
- transfer_file "$transferfile" || transfer_default $1
+ trpath=$1
+ transferfile=$trpath/transfer
+ [ -f "$transferfile" ] && rm -f "$trpath/install"
+ [ -f "$transferfile" ] || transferfile=$trpath/install
+ rm -f $trpath/readme.*
+ rm -f $trpath/README.*
+ rm -f $trpath/*.txt
+ rm -f $trpath/*.md
+ transfer_file "$transferfile" || transfer_default $1
}
pack_upath(){
- echo $installpath/hmod/uninstall-$(basename "$1" .hmod)
+ echo $installpath/hmod/uninstall-$(basename "$1" .hmod)
}
pack_install(){
echo Installing $1 package...
- if [ -f "$1" ]; then
- transferpath=$temppath/pack
- rm -rf "$transferpath"
- mkdir -p "$transferpath"
- cd "$transferpath" && tar -xzf "$1"
- else
- transferpath=$1
- fi
- transfer_path "$transferpath"
- mkdir -p "$installpath/hmod"
- if [ ! -f "$transferpath/uninstall" ]; then
- echo Creating uninstall for $1...
- cd "$transferpath"
- find . -type l -exec echo rm -f \"\$installpath/{}\" + >> "$transferpath/uninstall"
- find . -type f -exec echo rm -f \"\$installpath/{}\" + >> "$transferpath/uninstall"
- find . -mindepth 1 -type d -exec echo rmdir --ignore-fail-on-non-empty \"\$installpath/{}\" + >> "$transferpath/uninstall"
- fi
- cd /
- unfile=$(pack_upath "$1")
- copy "$transferpath/uninstall" "$unfile"
+ if [ -f "$1" ]; then
+ transferpath=$temppath/pack
+ rm -rf "$transferpath"
+ mkdir -p "$transferpath"
+ cd "$transferpath" && tar -xzf "$1"
+ else
+ transferpath=$1
+ fi
+ transfer_path "$transferpath"
+ mkdir -p "$installpath/hmod"
+ if [ ! -f "$transferpath/uninstall" ]; then
+ echo Creating uninstall for $1...
+ cd "$transferpath"
+ find . -type l -exec echo rm -f \"\$installpath/{}\" + >> "$transferpath/uninstall"
+ find . -type f -exec echo rm -f \"\$installpath/{}\" + >> "$transferpath/uninstall"
+ find . -mindepth 1 -type d -exec echo rmdir --ignore-fail-on-non-empty \"\$installpath/{}\" + >> "$transferpath/uninstall"
+ fi
+ cd /
+ unfile=$(pack_upath "$1")
+ copy "$transferpath/uninstall" "$unfile"
echo Package $1 installed
}
pack_uninstall(){
cd $installpath
- if [ "$1" == "all" ]; then
- for i in $(find "$installpath/hmod/" -maxdepth 1 -type f -name "uninstall-*" | sort); do
- echo Uninstalling $i package...
- unfile=$(pack_upath "$i")
- transfer_file "$unfile"
+ if [ "$1" == "all" ]; then
+ for i in $(find "$installpath/hmod/" -maxdepth 1 -type f -name "uninstall-*" | sort); do
+ echo Uninstalling $i package...
+ unfile=$(pack_upath "$i")
+ transfer_file "$unfile"
+ rm -f "$unfile"
+ echo Package $i uninstalled
+ done
+ else
+ echo Uninstalling $1 package...
+ unfile=$(pack_upath "$1")
+ transfer_file "$unfile"
rm -f "$unfile"
- echo Package $i uninstalled
- done
- else
- echo Uninstalling $1 package...
- unfile=$(pack_upath "$1")
- transfer_file "$unfile"
- rm -f "$unfile"
- fi
+ fi
cd /
}
packs_uninstall(){
[ -d "$1" ] || return 1
# To uninstall package we need only file or directory with the same name
- for i in $(find "$1" -maxdepth 1 -name "*.hmod" | sort); do
- pack_uninstall "$i"
- rm -rf "$i"
- done
+ for i in $(find "$1" -maxdepth 1 -name "*.hmod" | sort); do
+ pack_uninstall "$i"
+ rm -rf "$i"
+ done
}
packs_install(){
[ -d "$1" ] || return 1
- for i in $(find "$1" -maxdepth 1 -name "*.hmod" | sort); do
- pack_install "$i"
- rm -rf "$i"
- done
+ for i in $(find "$1" -maxdepth 1 -name "*.hmod" | sort); do
+ pack_install "$i"
+ rm -rf "$i"
+ done
}