[big-update] Now shares automatically 1. authorized_keys 2. unlock code via mysql on the server
This commit is contained in:
parent
7d16a0d8da
commit
d4c88bb918
18
clone/clone
18
clone/clone
|
@ -231,8 +231,6 @@ step6(){
|
|||
sudo chown 666:666 /mnt/home/sats/.ssh/config;
|
||||
sudo chmod 444 /mnt/home/sats/.ssh/config;
|
||||
|
||||
|
||||
|
||||
echo "<<< done";
|
||||
|
||||
step7;
|
||||
|
@ -385,7 +383,7 @@ step9(){
|
|||
echo "$UNLOCK_CODE" | sudo tee /mnt/home/sats/satsd/conf/machine.unlock > /dev/null;
|
||||
echo "$WAREHOUSE_TOKEN" | sudo tee /mnt/home/sats/satsd/conf/warehouse.token > /dev/null;
|
||||
|
||||
echo "$MACHINE_ID;$UNLOCK_CODE" | tee ./server/created > /dev/null;
|
||||
echo "$MACHINE_ID;$UNLOCK_CODE" | tee -a ./server/created > /dev/null;
|
||||
|
||||
# (3) Adjust permissions #
|
||||
echo " (.) Adjust permissions";
|
||||
|
@ -407,12 +405,24 @@ step9(){
|
|||
|
||||
|
||||
|
||||
# [10] BLablslkfjdlkdsjfks
|
||||
# [10] Umount device and share data to server
|
||||
#========================================================#
|
||||
step10(){
|
||||
echo "\n>>> Finishing properly";
|
||||
|
||||
echo " (.) Copying SATS public key to server's authorized_keys";
|
||||
cat ./server/authorized_keys | tail -n 1 | ssh smmp-server "cat >> ~/authorized_keys" || echo " (!) Cannot share public key";
|
||||
|
||||
echo " (.) Copying SATS unlock code to server's database";
|
||||
DB_PASS="e6mmCpx9Oks5BwS1rcPIrgRDIGLrmDQn9oqX0tqF2VhyiLDW6yKJFrafewwCZ63njYaDKiNjiAS11hrLYij7HaxTdHb33tEqby34vgVrUYaUnwPnCJHmkoyR3TfjcZNCPti8VZG0Oooq7qSHy4lcD6T4EFCcOQ_yHjVIfibvbuZqQcPTUvbDP_9910mRDBUADShIe4sjK2FLOTCz6usUKkNqTH3PldRfAgGl182Zw9tiSPJfvQZX3S2bKblNuZf1";
|
||||
DB_USER="sats-set-unlock";
|
||||
DB_DATABASE="logauth";
|
||||
ssh smmp-server "echo \"UPDATE machine SET unlock_code='$UNLOCK_CODE' WHERE id_machine = $MACHINE_ID;\" | mysql -u$DB_USER -p$DB_PASS --database=$DB_DATABASE" || echo " (!) Cannot share unlock code";
|
||||
|
||||
echo " (.) Unmounting remote device";
|
||||
sudo umount /mnt;
|
||||
|
||||
echo "<<< done";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue