Browse Source

fix(install): restore android support

addresses a regression in busybox installations

resolves #25
Josh Habdas 1 year ago
parent
commit
d3b2ab0ac0
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
1 changed files with 5 additions and 6 deletions
  1. 5
    6
      bin/install

+ 5
- 6
bin/install View File

@@ -33,20 +33,19 @@ create_site () {
33 33
 }
34 34
 
35 35
 download_theme () {
36
-   echo "Downloading the latest version of After Dark theme ..."
36
+   echo "Downloading the latest version of the After Dark theme ..."
37 37
    meta=$(wget -qO - https://registry.npmjs.org/after-dark/latest)
38
-   grep --version | grep "BSD grep" 1>/dev/null && vers=$(echo "$meta" | grep -oE '"version":(\d*?,|.*?[^\\]",)' | tr -d 'version": ,')
39
-   grep --version | grep "GNU grep" 1>/dev/null && vers=$(echo "$meta" | grep -oP '"version":(\d*?,|.*?[^\\]",)' | tr -d 'version": ,')
38
+   vers=$(echo "$meta" | egrep -o "\"version\".*[^,]*," | cut -d ',' -f1 | cut -d ':' -f2 | tr -d '" ')
40 39
    mkdir -p themes/after-dark
41 40
    wget -qO - https://registry.npmjs.org/after-dark/-/after-dark-"$vers".tgz | tar --strip-components=1 -xz -C themes/after-dark
42 41
    echo "Theme version $vers downloaded to $SITE_DIR/themes/after-dark"
43 42
 }
44 43
 
45 44
 download_module () {
46
-   echo "Downloading example module for After Dark theme ..."
45
+   [ -z "$1" ] && { echo "Error: Attempt to download undefined module" >&2; exit 1; }
46
+   echo "Downloading $1 module for After Dark theme ..."
47 47
    meta=$(wget -qO - https://registry.npmjs.org/"$1"/latest)
48
-   grep --version | grep "BSD grep" 1>/dev/null && vers=$(echo "$meta" | grep -oE '"version":(\d*?,|.*?[^\\]",)' | tr -d 'version": ,')
49
-   grep --version | grep "GNU grep" 1>/dev/null && vers=$(echo "$meta" | grep -oP '"version":(\d*?,|.*?[^\\]",)' | tr -d 'version": ,')
48
+   vers=$(echo "$meta" | egrep -o "\"version\".*[^,]*," | cut -d ',' -f1 | cut -d ':' -f2 | tr -d '" ')
50 49
    mkdir -p themes/"$1"
51 50
    wget -qO - https://registry.npmjs.org/"$1"/-/"$1"-"$vers".tgz | tar --strip-components=1 -xz -C themes/"$1"
52 51
    echo "Module version $vers downloaded to $SITE_DIR/themes/$1"

Loading…
Cancel
Save