From a0547d8756c7da247e28a99ce0d3abf7c1d6d8de Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 25 Jan 2017 19:52:51 +0100 Subject: [PATCH] fixing trouble with service name (was sats-boot-process.service) --- clone/clone | 28 ++++++++++----------- clone/utility/sats-boot | 33 ++++++++----------------- clone/utility/sats-boot-process | 15 ----------- clone/utility/sats-boot-process.service | 12 --------- clone/utility/sats-boot.service | 13 +++++----- clone/utility/sats-loop | 28 +++++++++++++++++++++ clone/utility/sats-loop.service | 13 ++++++++++ 7 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 clone/utility/sats-boot-process delete mode 100644 clone/utility/sats-boot-process.service create mode 100644 clone/utility/sats-loop create mode 100644 clone/utility/sats-loop.service diff --git a/clone/clone b/clone/clone index fbba3a0..e33dfd1 100755 --- a/clone/clone +++ b/clone/clone @@ -237,18 +237,18 @@ step7(){ #sudo touch /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf; #cat ./utility/autologin_overload.conf | sudo tee /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf > /dev/null; - # (2) Install sats-boot-process service # - echo " (.) Create sats-boot-process service"; + # (2) Install sats-boot service # + echo " (.) Create sats-boot service"; echo " - /lib/systemd/system"; - sudo cp ./utility/sats-boot-process.service /mnt/lib/systemd/system/sats-boot-process.service; + sudo cp ./utility/sats-boot.service /mnt/lib/systemd/system/sats-boot.service; - echo " (.) Create sats-boot-process script"; - sudo cp ./utility/sats-boot-process /mnt/home/pi/sats-boot-process; - sudo chown 1000:1000 /mnt/home/pi/sats-boot-process; - sudo chmod 770 /mnt/home/pi/sats-boot-process; + echo " (.) Create sats-boot script"; + sudo cp ./utility/sats-boot /mnt/home/pi/sats-boot; + sudo chown 1000:1000 /mnt/home/pi/sats-boot; + sudo chmod 770 /mnt/home/pi/sats-boot; - echo " (.) Emulate \`systemctl enable sats-boot-process\`"; - sudo ln -fs /lib/systemd/system/sats-boot-process.service /mnt/etc/systemd/system/multi-user.target.wants/sats-boot-process.service; + echo " (.) Emulate \`systemctl enable sats-boot\`"; + sudo ln -fs /lib/systemd/system/sats-boot.service /mnt/etc/systemd/system/multi-user.target.wants/sats-boot.service; @@ -296,16 +296,16 @@ step9(){ # (2) Set up SATS botting script # echo " (.) Set up SATS booting script"; - cat ./utility/sats-boot | sudo tee /mnt/home/sats/satsd/sats-boot > /dev/null; + cat ./utility/sats-loop | sudo tee /mnt/home/sats/satsd/sats-loop > /dev/null; # (3) Set up service unit # - echo " (.) Set up service unit (sats-boot.service)"; - cat ./utility/sats-boot.service | sudo tee /mnt/lib/systemd/system/sats-boot.service > /dev/null; + echo " (.) Set up service unit (sats-loop.service)"; + cat ./utility/sats-loop.service | sudo tee /mnt/lib/systemd/system/sats-loop.service > /dev/null; # (4) Enable startup service unit # - echo " (.) Emulate \`systemctl enable sats-boot.service\`"; + echo " (.) Emulate \`systemctl enable sats-loop.service\`"; sudo mkdir -p /mnt/etc/systemd/system/multi-user.target.wants; - sudo ln -fs /lib/systemd/system/sats-boot.service /mnt/etc/systemd/system/multi-user.target.wants/sats-boot.service; + sudo ln -fs /lib/systemd/system/sats-loop.service /mnt/etc/systemd/system/multi-user.target.wants/sats-loop.service; # (5) Adjust permissions # echo " (.) Adjust permissions"; diff --git a/clone/utility/sats-boot b/clone/utility/sats-boot index 5fb8e73..3e5d1a9 100644 --- a/clone/utility/sats-boot +++ b/clone/utility/sats-boot @@ -1,28 +1,15 @@ #!/bin/sh -# [1] first install (install source code) -if [ -e /home/sats/satsd/first_install ]; then +# [1] Set random passwords for 'sats' +RANDOM_PASS=$(tr -cd A-Za-z0-9_ < /dev/urandom | head -c 256); +echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd sats; - usegit=1; - git > /dev/null 2> /dev/null || usegit=0; +# [2] Set random passwords for 'pi' itself +RANDOM_PASS=$(tr -cd A-Za-z0-9_ < /dev/urandom | head -c 256); +echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi; - # install source code - if [ $usegit -eq 1 ]; then +# [3] Start ssh service +sudo systemctl start ssh; - git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \ - && rm /home/sats/satsd/first_install \ - || exit; - - else - - # temporary replacement (without git) - scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \ - && rm /home/sats/satsd/first_install \ - || exit; - fi; - -fi; - - -# [2] Propagate script -sh /home/sats/satsd/source/boot $* 2>> /home/sats/satsd/log/boot.log >> /home/sats/satsd/log/boot.log; +# [4] Try to install necessary packages +sudo apt-get install git; diff --git a/clone/utility/sats-boot-process b/clone/utility/sats-boot-process deleted file mode 100644 index 3e5d1a9..0000000 --- a/clone/utility/sats-boot-process +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# [1] Set random passwords for 'sats' -RANDOM_PASS=$(tr -cd A-Za-z0-9_ < /dev/urandom | head -c 256); -echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd sats; - -# [2] Set random passwords for 'pi' itself -RANDOM_PASS=$(tr -cd A-Za-z0-9_ < /dev/urandom | head -c 256); -echo "$RANDOM_PASS\n$RANDOM_PASS\n" | sudo passwd pi; - -# [3] Start ssh service -sudo systemctl start ssh; - -# [4] Try to install necessary packages -sudo apt-get install git; diff --git a/clone/utility/sats-boot-process.service b/clone/utility/sats-boot-process.service deleted file mode 100644 index 324998c..0000000 --- a/clone/utility/sats-boot-process.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=SATS Boot Process - -[Service] -Type=oneshot -RemainAfterExit=yes -User=pi -Group=pi -ExecStart=/bin/sh /home/pi/sats-boot-process - -[Install] -WantedBy=multi-user.target diff --git a/clone/utility/sats-boot.service b/clone/utility/sats-boot.service index 7651eb3..4c9462c 100644 --- a/clone/utility/sats-boot.service +++ b/clone/utility/sats-boot.service @@ -1,13 +1,12 @@ [Unit] -Description=SATS (Secure Authentication and Tracking SYSTEM) Daemon +Description=SATS Boot Process [Service] -Type=simple -User=sats -Group=sats -ExecStart=/bin/sh /home/sats/satsd/sats-boot -Restart=on-abort - +Type=oneshot +RemainAfterExit=yes +User=pi +Group=pi +ExecStart=/bin/sh /home/pi/sats-boot [Install] WantedBy=multi-user.target diff --git a/clone/utility/sats-loop b/clone/utility/sats-loop new file mode 100644 index 0000000..5fb8e73 --- /dev/null +++ b/clone/utility/sats-loop @@ -0,0 +1,28 @@ +#!/bin/sh + +# [1] first install (install source code) +if [ -e /home/sats/satsd/first_install ]; then + + usegit=1; + git > /dev/null 2> /dev/null || usegit=0; + + # install source code + if [ $usegit -eq 1 ]; then + + git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \ + && rm /home/sats/satsd/first_install \ + || exit; + + else + + # temporary replacement (without git) + scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \ + && rm /home/sats/satsd/first_install \ + || exit; + fi; + +fi; + + +# [2] Propagate script +sh /home/sats/satsd/source/boot $* 2>> /home/sats/satsd/log/boot.log >> /home/sats/satsd/log/boot.log; diff --git a/clone/utility/sats-loop.service b/clone/utility/sats-loop.service new file mode 100644 index 0000000..566d408 --- /dev/null +++ b/clone/utility/sats-loop.service @@ -0,0 +1,13 @@ +[Unit] +Description=SATS (Secure Authentication and Tracking SYSTEM) Daemon + +[Service] +Type=simple +User=sats +Group=sats +ExecStart=/bin/sh /home/sats/satsd/sats-loop +Restart=on-abort + + +[Install] +WantedBy=multi-user.target