summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-07 01:00:13 +0530
committerAndinus <andinus@nand.sh>2020-04-07 01:00:13 +0530
commitcd4325250d64799ef328c51ddc36ab0a14d1e640 (patch)
tree7e613a7e48a11dd08f4d4f0fdc90fbc9a7b70025
parent0a6d510d2add0e46e890cc6fcac39d3080ba689b (diff)
downloadgrus-cd4325250d64799ef328c51ddc36ab0a14d1e640.tar.gz
Add init and install scripts
-rwxr-xr-xscripts/grus-add2
-rwxr-xr-xscripts/init13
-rwxr-xr-xscripts/install56
3 files changed, 71 insertions, 0 deletions
diff --git a/scripts/grus-add b/scripts/grus-add
index ec1eac8..4c3311a 100755
--- a/scripts/grus-add
+++ b/scripts/grus-add
@@ -52,3 +52,5 @@ if __name__ == '__main__':
 
     curs.close()
     conn.close()
+
+    print("Database initialized.")
diff --git a/scripts/init b/scripts/init
new file mode 100755
index 0000000..1ca1f12
--- /dev/null
+++ b/scripts/init
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Download the list of words.
+curl -o /tmp/words.txt \
+     https://raw.githubusercontent.com/dwyl/english-words/master/words.txt
+
+# Make the script executable.
+chmod +x grus-add
+
+# Add those words to the database.
+./grus-add \
+    -d $HOME/.local/share/grus/grus.db \
+    -f /tmp/words.txt
diff --git a/scripts/install b/scripts/install
new file mode 100755
index 0000000..bc02528
--- /dev/null
+++ b/scripts/install
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+openbsdH="25a8dc77cda3d225c85d3f0cb318d01c17546c1c4a8c789a318f832ce1948bc3"
+
+earlyCheck(){
+    os=`uname`
+    os=`echo $os | tr "[:upper:]" "[:lower:"]`
+
+    case $os in
+        *openbsd* ) ;;
+        *)
+            echo "Pre-built binary not available for your os"
+            exit 1
+            ;;
+    esac
+
+    cpu=`uname -m`
+    cpu=`echo $cpu | tr "[:upper:]" "[:lower:"]`
+
+    case $cpu in
+        *amd*64* | *x86*64* ) ;;
+        *)
+            echo "Pre-built binary not available for your cpu"
+            exit 1
+            ;;
+    esac
+}
+
+getURL(){
+    url="https://archive.org/download/grus-v0.1.0/grus-v0.1.0-$os-$cpu"
+}
+
+printURL(){
+    echo "You can get the Pre-built binary here:"
+    echo "$url"
+    echo
+    echo "Run these commands to install it on your device."
+    echo "# curl -L -o /usr/local/bin/grus $url"
+    echo "# chmod +x /usr/local/bin/grus"
+    echo
+    echo "This is sha256 hash for grus built for: $os $cpu"
+    case $os in
+        *openbsd* )
+            echo "$openbsdH"
+            ;;
+    esac
+    echo
+    echo "Verify the hash by running sha256 on grus binary."
+    echo "$ sha256 /usr/local/bin/grus"
+}
+
+echo "Grus v0.1.0"
+echo
+earlyCheck
+getURL
+printURL