fixing trouble with service name (was sats-boot-process.service)

This commit is contained in:
xdrm-brackets 2017-01-25 19:52:51 +01:00
parent 1da2452c76
commit a0547d8756
7 changed files with 71 additions and 71 deletions

View File

@ -237,18 +237,18 @@ step7(){
#sudo touch /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf; #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; #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 # # (2) Install sats-boot service #
echo " (.) Create sats-boot-process service"; echo " (.) Create sats-boot service";
echo " - /lib/systemd/system"; 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"; echo " (.) Create sats-boot script";
sudo cp ./utility/sats-boot-process /mnt/home/pi/sats-boot-process; sudo cp ./utility/sats-boot /mnt/home/pi/sats-boot;
sudo chown 1000:1000 /mnt/home/pi/sats-boot-process; sudo chown 1000:1000 /mnt/home/pi/sats-boot;
sudo chmod 770 /mnt/home/pi/sats-boot-process; sudo chmod 770 /mnt/home/pi/sats-boot;
echo " (.) Emulate \`systemctl enable sats-boot-process\`"; echo " (.) Emulate \`systemctl enable sats-boot\`";
sudo ln -fs /lib/systemd/system/sats-boot-process.service /mnt/etc/systemd/system/multi-user.target.wants/sats-boot-process.service; 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 # # (2) Set up SATS botting script #
echo " (.) Set up SATS booting 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 # # (3) Set up service unit #
echo " (.) Set up service unit (sats-boot.service)"; echo " (.) Set up service unit (sats-loop.service)";
cat ./utility/sats-boot.service | sudo tee /mnt/lib/systemd/system/sats-boot.service > /dev/null; cat ./utility/sats-loop.service | sudo tee /mnt/lib/systemd/system/sats-loop.service > /dev/null;
# (4) Enable startup service unit # # (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 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 # # (5) Adjust permissions #
echo " (.) Adjust permissions"; echo " (.) Adjust permissions";

View File

@ -1,28 +1,15 @@
#!/bin/sh #!/bin/sh
# [1] first install (install source code) # [1] Set random passwords for 'sats'
if [ -e /home/sats/satsd/first_install ]; then 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; # [2] Set random passwords for 'pi' itself
git > /dev/null 2> /dev/null || usegit=0; 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 # [3] Start ssh service
if [ $usegit -eq 1 ]; then sudo systemctl start ssh;
git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \ # [4] Try to install necessary packages
&& rm /home/sats/satsd/first_install \ sudo apt-get install git;
|| 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;

View File

@ -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;

View File

@ -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

View File

@ -1,13 +1,12 @@
[Unit] [Unit]
Description=SATS (Secure Authentication and Tracking SYSTEM) Daemon Description=SATS Boot Process
[Service] [Service]
Type=simple Type=oneshot
User=sats RemainAfterExit=yes
Group=sats User=pi
ExecStart=/bin/sh /home/sats/satsd/sats-boot Group=pi
Restart=on-abort ExecStart=/bin/sh /home/pi/sats-boot
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

28
clone/utility/sats-loop Normal file
View File

@ -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;

View File

@ -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