From ad8fa10d98102471132669aecf49ead53f81d96a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 18 Jul 2017 17:18:30 +0200 Subject: [PATCH] (1) Added MACHINE_ID in private SSH key (2) removed update/install at boot (only first time) --- clone/clone | 4 ++-- clone/clone.conf | 2 +- clone/utility/sats-install | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/clone/clone b/clone/clone index dfbe955..162f7f2 100755 --- a/clone/clone +++ b/clone/clone @@ -195,14 +195,14 @@ step6(){ # (1) Create ssh key pair # echo " (.) Create ssh key [ecdsa:521]"; - ssh-keygen -t ecdsa -b 521 -C "[ECDSA:521] SATS" -f ./tmp/id_ecdsa -P "" 2> /dev/null > /dev/null; + ssh-keygen -t ecdsa -b 521 -C "[ECDSA:521] SATS@$MACHINE_ID" -f ./tmp/id_ecdsa -P "" 2> /dev/null > /dev/null; # (2) Add public key to server's `authorized_keys` file # echo " (.) Add public key to server's list"; test ! -e ./server/authorized_keys && touch ./server/authorized_keys; cat ./tmp/id_ecdsa.pub >> ./server/authorized_keys; -# (3) Create ssh file system # + # (3) Create ssh file system # echo " (.) Init ssh folder (/home/sats/.ssh)"; sudo mkdir -p /mnt/home/sats/.ssh; diff --git a/clone/clone.conf b/clone/clone.conf index ab46c4f..3aae442 100755 --- a/clone/clone.conf +++ b/clone/clone.conf @@ -15,7 +15,7 @@ export SERVER_HOSTNAME="xdrm.io"; export SERVER_USERNAME="satsd"; # DEFAULT SATS SETTINGS -export MACHINE_ID="127"; +export MACHINE_ID="126"; export MACHINE_BRANCH="1.0"; export MACHINE_STATE="000"; export API_URL="https://logauth.xdrm.io/api/machineDefault"; diff --git a/clone/utility/sats-install b/clone/utility/sats-install index fc417b4..bfadf82 100644 --- a/clone/utility/sats-install +++ b/clone/utility/sats-install @@ -24,12 +24,6 @@ RANDOM_PASS=$(tr -cd A-Za-z0-9_ < /dev/urandom | head -c 256); echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi; echo "pi password changed" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; -# [5] Try to install necessary packages -sudo apt-get update; -echo "package update done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; -sudo apt-get -y install git php5 php5-cli php5-curl python-dev; -echo "package install done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; - @@ -38,11 +32,17 @@ echo "package install done" | sudo -u sats tee -a /home/sats/satsd/log/install.l ################################################ if [ ! -e /target/install ]; then + # (1) Try to install necessary packages + sudo apt-get update; + echo "package update done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; + sudo apt-get -y install git php5 php5-cli php5-curl python-dev; + echo "package install done" | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null; + dpkg -s git 2>/dev/null >/dev/null && gitinstalled=1 || gitinstalled=0; BRANCH=$(sudo cat /home/sats/satsd/conf/machine.branch) > /dev/null; - # (1) With git if installed # + # (2) With git if installed # if [ $gitinstalled -eq 1 ]; then echo "cloning source.." | sudo -u sats tee -a /home/sats/satsd/log/install.log > /dev/null;