Commit 2f155ac4786bb136fd23d7bb1d50ef081912c093

Authored by Adhidarma Hadiwinoto
1 parent cce281e7a4
Exists in master

tools/bin dir

Showing 2 changed files with 42 additions and 0 deletions Side-by-side Diff

tools/bin/komodo-modems-update
... ... @@ -0,0 +1,17 @@
  1 +#!/bin/bash
  2 +
  3 +set -x
  4 +
  5 +tmp_dir=$(mktemp -d -t komodo-modems-update-XXXXXXXXXX)
  6 +
  7 +cd $tmp_dir
  8 +git clone http://gitlab.kodesumber.com/komodo/komodo-modem-sms.git modem
  9 +cd $tmp_dir/modem
  10 +npm ci;
  11 +
  12 +for i in ACM USB; do
  13 + seq 0 55| xargs -n1 -P 5 -I{} /home/komodo/bin/komodo-modems-update-helper $i{} $tmp_dir/modem/node_modules
  14 + #seq 0 55| xargs -n1 -P 5 -I{} /home/komodo/bin/komodo-modems-update-helper $i{}
  15 +done
  16 +
  17 +rm -rf $tmp_dir
tools/bin/komodo-modems-update-helper
... ... @@ -0,0 +1,25 @@
  1 +#!/bin/bash
  2 +set -x
  3 +
  4 +#if [ -z "$2" ]; then
  5 +# echo Invalid arguments
  6 +# exit 1
  7 +#fi
  8 +
  9 +[ -d /home/komodo/modems/$1 ] || { echo /home/komodo/modems/$1 does not exits; exit 1; }
  10 +
  11 +# [ -d $2 ] || { echo $2 does not exits; exit 1; }
  12 +
  13 +echo Processing $1
  14 +cd /home/komodo/modems/$1
  15 +pwd
  16 +echo Pulling for $1
  17 +git pull
  18 +
  19 +[ -n "$2" ] && [ -d $2 ] && {
  20 + rm -rf /home/komodo/modems/$1/node_modules/;
  21 + cp -r $2 /home/komodo/modems/$1
  22 +}
  23 +
  24 +[ -f /home/komodo/modems/$1/pid.txt ] && kill `cat /home/komodo/modems/$1/pid.txt`
  25 +echo $1 finished