]> gitweb @ CieloNegro.org - gregtech6.git/commitdiff
Initial commit
authorPHO <pho@cielonegro.org>
Wed, 4 Apr 2018 15:45:35 +0000 (00:45 +0900)
committerPHO <pho@cielonegro.org>
Wed, 4 Apr 2018 15:46:29 +0000 (00:46 +0900)
.gitignore [new file with mode: 0644]
Import [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..305c762
--- /dev/null
@@ -0,0 +1,2 @@
+summary.txt
+_work
diff --git a/Import b/Import
new file mode 100755 (executable)
index 0000000..05d3724
--- /dev/null
+++ b/Import
@@ -0,0 +1,104 @@
+#!/usr/bin/env bash
+set -o errexit -o nounset
+
+# -----------------------------------------------------------------------------
+# Configuration
+#
+readonly mc_version="1.7.10"
+readonly master_site="https://gregtech.overminddl1.com/com/gregoriust/gregtech/gregtech_${mc_version}"
+readonly workdir="_work"
+
+# -----------------------------------------------------------------------------
+# Argument parsing
+#
+declare gt_version
+
+function usage() {
+    echo >&2 "Usage: $0 VERSION"
+}
+while getopts h OPT; do
+    case $OPT in
+        h)
+            usage; exit 0;;
+        \?)
+            usage; exit 1;;
+    esac
+done
+shift $((OPTIND - 1))
+
+if (( $# == 0 )); then
+    usage; exit 1
+else
+    gt_version="$1"
+fi
+
+# -----------------------------------------------------------------------------
+# Utility functions
+#
+function run() {
+    # Is the /dev/stdout a tty?
+    if [[ -t 1 ]]; then
+        echo -ne "\e[1;32m" # bold + green
+        echo "$@"
+        echo -ne "\e[0m"
+    else
+        echo "$@"
+    fi
+
+    "$@"
+}
+
+function msg() {
+    # Is the /dev/stdout a tty?
+    if [[ -t 1 ]]; then
+        echo -ne "\e[1;33m" # bold + yellow
+        echo "$@"
+        echo -ne "\e[0m"
+    else
+        echo "$@"
+    fi
+}
+
+# -----------------------------------------------------------------------------
+# Downloading distribution files
+#
+msg "=> Importing GregTech ${gt_version}"
+msg -n "==> Type [RET] to continue..."
+read
+
+readonly mod_jar="gregtech_${mc_version}-${gt_version}.jar"
+readonly api_jar="gregtech_${mc_version}-${gt_version}-sources.jar"
+mkdir -p "${workdir}/dist"
+
+msg "==> Downloading ${mod_jar}"
+#run curl "${master_site}/${gt_version}/${mod_jar}" -o "${workdir}/dist/${mod_jar}" --time-cond "${workdir}/dist/${mod_jar}" --continue-at -
+
+msg "==> Downloading ${api_jar}"
+#run curl "${master_site}/${gt_version}/${api_jar}" -o "${workdir}/dist/${api_jar}" --time-cond "${workdir}/dist/${api_jar}" --continue-at -
+
+# -----------------------------------------------------------------------------
+# Decompiling the mod
+#
+msg "==> Decompiling ${mod_jar}"
+#run cfr "${workdir}/dist/${mod_jar}" --outputdir .
+
+# -----------------------------------------------------------------------------
+# Unpacking API sources
+#
+msg "==> Unpacking API sources"
+run jar -xf "${workdir}/dist/${api_jar}" gregapi
+
+# -----------------------------------------------------------------------------
+# Unpacking assets
+#
+msg "==> Unpacking assets"
+run jar -xf "${workdir}/dist/${mod_jar}" assets
+
+# -----------------------------------------------------------------------------
+# Creating a commit and a tag
+#
+msg "==> Creating a commit"
+run git commit --all --message "Import GregTech ${gt_version}"
+
+msg "==> Tagging the commit"
+run git tag --annotate --message "GregTech ${gt_version} (Official)" "GregTech-${gt_version}"