From 7775d1065c615876bee750dad5827f834e904013 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Thu, 29 Aug 2024 11:04:01 +0200 Subject: [PATCH] [setup-x48ng-home.sh] remove @PREFIX@ and mkcard dependency --- Makefile | 2 +- dist/setup-x48ng-home.sh | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2c71232..58e53a2 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,7 @@ install: all dist/config.lua install -c -m 755 dist/checkrom $(DESTDIR)$(PREFIX)/share/x48ng/checkrom install -c -m 644 dist/hplogo.png $(DESTDIR)$(PREFIX)/share/x48ng/hplogo.png cp -R dist/ROMs/ $(DESTDIR)$(PREFIX)/share/x48ng/ - sed "s|@PREFIX@|$(PREFIX)|g" dist/setup-x48ng-home.sh > $(DESTDIR)$(PREFIX)/share/x48ng/setup-x48ng-home.sh + install -c -m 755 dist/setup-x48ng-home.sh $(DESTDIR)$(PREFIX)/share/x48ng/setup-x48ng-home.sh chmod 755 $(DESTDIR)$(PREFIX)/share/x48ng/setup-x48ng-home.sh install -m 755 -d -- $(DESTDIR)$(MANDIR)/man1 diff --git a/dist/setup-x48ng-home.sh b/dist/setup-x48ng-home.sh index 17759bf..c4dbfb9 100755 --- a/dist/setup-x48ng-home.sh +++ b/dist/setup-x48ng-home.sh @@ -1,6 +1,9 @@ #!/usr/bin/env sh -DOTX48NG=${DOTX48NG:-~/.config/x48ng} +cd "$(dirname "$0")" ; CWD=$(pwd) + +CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} +DOTX48NG=${DOTX48NG:-$CONFIG_HOME/x48ng} CONFIG_FILE="${DOTX48NG}"/config.lua ROM=${ROM:-./ROMs/gxrom-r} @@ -9,7 +12,7 @@ mkdir -p "${DOTX48NG}" [ -e "${CONFIG_FILE}" ] && mv "${CONFIG_FILE}" "${CONFIG_FILE}".orig x48ng --print-config > "${CONFIG_FILE}" -cp -r @PREFIX@/share/x48ng/ROMs/ "${DOTX48NG}"/ +cp -r ./ROMs/ "${DOTX48NG}"/ cd "${DOTX48NG}"/ROMs/ || exit 1 echo "The next step will download all available HP 48 ROMs from https://hpcalc.org where \"HP graciously began allowing this to be downloaded in mid-2000.\"" @@ -21,15 +24,15 @@ cd "${DOTX48NG}" || exit 1 [ -e rom ] && mv rom rom.orig ln -s "$ROM" rom -PORT1_SIZE=128K -PORT2_SIZE=4M +PORT1_SIZE=128 +PORT2_SIZE=4096 -if $(echo "$ROM" | grep -q "^sx"); then - PORT2_SIZE=128K +if echo "$ROM" | grep -q "^sx"; then + PORT2_SIZE=128 fi [ -e port1 ] && mv port1 port1.orig -@PREFIX@/share/x48ng/mkcard $PORT1_SIZE port1 +dd if=/dev/zero of="$DOTX48NG"/port1 bs=1k count=$PORT1_SIZE [ -e port2 ] && mv port2 port2.orig -@PREFIX@/share/x48ng/mkcard $PORT2_SIZE port2 +dd if=/dev/zero of="$DOTX48NG"/port2 bs=1k count=$PORT2_SIZE