summarylogtreecommitdiffstats
path: root/copier.sh
diff options
context:
space:
mode:
authorWorMzy Tykashi2016-01-13 17:32:00 +0000
committerWorMzy Tykashi2016-01-13 17:32:00 +0000
commit6961c1e821eeb3a5d3598c140c5360fe3126a26e (patch)
treecea6da5cbfc9aedb7ade260e355f844b3603306d /copier.sh
downloadaur-6961c1e821eeb3a5d3598c140c5360fe3126a26e.tar.gz
Initial commit
Diffstat (limited to 'copier.sh')
-rwxr-xr-xcopier.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/copier.sh b/copier.sh
new file mode 100755
index 000000000000..a23eb269f165
--- /dev/null
+++ b/copier.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+function _fail() {
+ echo "ERROR: Failed to find or copy \"$1\""
+ exit 1
+}
+
+if [ ! -r filelist ]; then
+ echo "ERROR: Can't read filelist"
+ exit 1
+fi
+
+read -p "Enter the path to the TFTD data files: " _tftdpath
+if [ ! -d $_tftdpath ]; then
+ echo "ERROR: No such directory"
+ exit 1
+fi
+
+IFS="
+"
+for file in $(cat filelist); do
+ # Handle files with identical names but different content
+ case "$file" in
+ LOFTEMPS.DAT|SCANG.DAT)
+ if ! find $_tftdpath -path "*TERRAIN/$file" -exec cp "{}" ./"ter-$file" \; &>/dev/null; then
+ _fail $file
+ fi
+ if ! find $_tftdpath -path "*GEODATA/$file" -exec cp "{}" ./"geo-$file" \; &>/dev/null; then
+ _fail $file
+ fi
+ ;;
+ *)
+ if ! find $_tftdpath -name "$file" -exec cp "{}" . \; &>/dev/null; then
+ _fail $file
+ fi
+ ;;
+ esac
+done
+
+echo "All files successfully copied, now run makepkg"