Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 committed Aug 30, 2018
0 parents commit ff5a0a7
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
out/
mod/sfdisk
util-linux-2.31.1/
util-linux-2.31.1.tar.xz
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
MOD_NAME := $(shell head -n 1 mod/readme.md | cut -c 3-)
MOD_CREATOR := DanTheMan827
MOD_CATEGORY := SD
GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
GIT_TAG := $(shell git describe --tags)
MOD_FILENAME := $(shell basename "`git config --get remote.origin.url`" .hmod.git)

all: out/$(MOD_FILENAME)-$(GIT_COMMIT).hmod

out/$(MOD_FILENAME)-$(GIT_COMMIT).hmod: mod/sfdisk
mkdir -p out/ temp/
mkdir -p out/ temp/
rsync -a mod/ temp/ --links --delete

printf "%s\n" \
"---" \
"Name: $(MOD_NAME)" \
"Creator: $(MOD_CREATOR)" \
"Category: $(MOD_CATEGORY)" \
"Version: $(GIT_TAG)" \
"Packed on: $(shell date)" \
"Git commit: $(GIT_COMMIT)" \
"---" > temp/readme.md

sed 1d mod/readme.md >> temp/readme.md
cd temp/; tar -czvf "../$@" *
rm -r temp/
touch "$@"

mod/sfdisk: util-linux-2.31.1/sfdisk.static
cp "$<" "$@"
chmod +x "$@"

util-linux-2.31.1/sfdisk.static: util-linux-2.31.1/configure
cd "util-linux-2.31.1/" && \
./configure --host=arm-linux-gnueabihf --enable-static-programs=sfdisk --without-tinfo --without-util --without-ncurses && \
make sfdisk.static && \
arm-linux-gnueabihf-strip sfdisk.static

util-linux-2.31.1/configure: util-linux-2.31.1.tar.xz
tar -xJvf "$<"
touch "$@"

util-linux-2.31.1.tar.xz:
wget "https://www.kernel.org/pub/linux/utils/util-linux/v2.31/util-linux-2.31.1.tar.xz" -O "$@" --no-use-server-timestamps


clean: clean-hmod
-rm -rf "util-linux-2.31.1.tar.xz" "util-linux-2.31.1/"

clean-hmod:
-rm -rf "out/" "mod/sfdisk"

.PHONY: clean clean-hmod
25 changes: 25 additions & 0 deletions mod/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[ ! -b "/dev/mmcblk0" ] && echo "No SD card found, did you install the SD uboot?" && (rm "$transferpath/sfdisk"; return 1)

sdprep="$transferpath/sdprep"

chmod +x "$transferpath/sfdisk"

echo "Partitioning and formatting SD card"
echo ""

"$transferpath/sfdisk" "/dev/mmcblk0" <<EOT
,,L
EOT

rm "$transferpath/sfdisk"

yes | mke2fs -t ext4 -L data -b 4K -E stripe-width=32 -O ^huge_file,^metadata_csum /dev/mmcblk0p1

mkdir "$sdprep"
mount "/dev/mmcblk0p1" "$sdprep" || (echo "Error mounting SD card" && return 1)

mkdir -p "$sdprep/$modname/games" "$sdprep/$modname/saves"

sync
umount "$sdprep" && rmdir "$sdprep"

5 changes: 5 additions & 0 deletions mod/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Hakchi SD Prep

This will **erase all data on the SD card** and format it with EXT4.

It will also create the needed directories so that hakchi will store saves and games on the card.
3 changes: 3 additions & 0 deletions mod/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return 0
no-uninstall

1 change: 1 addition & 0 deletions readme.md

0 comments on commit ff5a0a7

Please sign in to comment.