summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorkyechou2017-08-01 09:55:49 +0800
committerkyechou2017-08-01 09:55:49 +0800
commit47b331330b43ba51354b820922cad6681ff8a0b7 (patch)
treec503edc725a833506e0e6a48308973b24692b1e3
parent97c979089e00ca30c814e7f8a253e7f1e90b8a08 (diff)
downloadaur-47b331330b43ba51354b820922cad6681ff8a0b7.tar.gz
update install scripts
-rw-r--r--shifter-imagegw.install54
-rw-r--r--shifter-runtime.install32
2 files changed, 22 insertions, 64 deletions
diff --git a/shifter-imagegw.install b/shifter-imagegw.install
index 7f50cfe3fcdc..64044fe49d3f 100644
--- a/shifter-imagegw.install
+++ b/shifter-imagegw.install
@@ -1,60 +1,32 @@
post_install() {
- systemctl daemon-reload
-
- echo -e "\e[34;1m==>\e[39;1m Enabling mongodb.service... \e[0m"
- MONGODB_ENABLED="$(systemctl list-unit-files | grep enabled | grep mongodb.service)"
- [ -z "$MONGODB_ENABLED" ] && systemctl enable mongodb.service
-
- echo -e "\e[34;1m==>\e[39;1m Starting mongodb.service... \e[0m"
- MONGODB_STARTED="$(systemctl | grep running | grep mongodb.service)"
- [ -z "$MONGODB_STARTED" ] && systemctl start mongodb.service
-
- echo -e "\e[34;1m==>\e[39;1m Enabling redis.service... \e[0m"
- REDIS_ENABLED="$(systemctl list-unit-files | grep enabled | grep redis.service)"
- [ -z "$REDIS_ENABLED" ] && systemctl enable redis.service
-
- echo -e "\e[34;1m==>\e[39;1m Starting redis.service... \e[0m"
- REDIS_STARTED="$(systemctl | grep running | grep redis.service)"
- [ -z "$REDIS_STARTED" ] && systemctl start redis.service
-
- echo -e "\e[34;1m==>\e[39;1m Enabling munge.service... \e[0m"
- MUNGE_ENABLED="$(systemctl list-unit-files | grep enabled | grep munge.service)"
- [ -z "$MUNGE_ENABLED" ] && systemctl enable munge.service
-
- echo -e "\e[34;1m==>\e[39;1m Starting munge.service... \e[0m"
- MUNGE_STARTED="$(systemctl | grep running | grep munge.service)"
- [ -z "$MUNGE_STARTED" ] && systemctl start munge.service
-
- echo -e "\e[34;1m==>\e[39;1m Loading kernel modules... \e[0m"
- [ -z "$(lsmod | grep ^squashfs)" ] && modprobe squashfs
- [ -n "$(lsmod | grep ^squashfs)" ] && echo -e " \e[34;1m==>\e[39;1m squashfs... loaded\e[0m"
+ post_upgrade
echo -e "\e[39;1m- Please make sure that the Shifter runtimes and the image gateway has the same munge key.\e[0m"
echo -e "\e[39;1m- Check the configuration file (/etc/shifter/imagemanager.json) before starting the shifter-imagegw.service.\e[0m"
}
post_upgrade() {
+ systemctl daemon-reload
+
echo -e "\e[34;1m==>\e[39;1m Enabling mongodb.service... \e[0m"
- MONGODB_ENABLED="$(systemctl list-unit-files | grep enabled | grep mongodb.service)"
- [ -z "$MONGODB_ENABLED" ] && systemctl enable mongodb.service
+ systemctl is-enabled mongodb.service || systemctl enable mongodb.service
echo -e "\e[34;1m==>\e[39;1m Starting mongodb.service... \e[0m"
- MONGODB_STARTED="$(systemctl | grep running | grep mongodb.service)"
- [ -z "$MONGODB_STARTED" ] && systemctl start mongodb.service
+ systemctl is-active mongodb.service || systemctl start mongodb.service
echo -e "\e[34;1m==>\e[39;1m Enabling redis.service... \e[0m"
- REDIS_ENABLED="$(systemctl list-unit-files | grep enabled | grep redis.service)"
- [ -z "$REDIS_ENABLED" ] && systemctl enable redis.service
+ systemctl is-enabled redis.service || systemctl enable redis.service
echo -e "\e[34;1m==>\e[39;1m Starting redis.service... \e[0m"
- REDIS_STARTED="$(systemctl | grep running | grep redis.service)"
- [ -z "$REDIS_STARTED" ] && systemctl start redis.service
+ systemctl is-active redis.service || systemctl start redis.service
echo -e "\e[34;1m==>\e[39;1m Enabling munge.service... \e[0m"
- MUNGE_ENABLED="$(systemctl list-unit-files | grep enabled | grep munge.service)"
- [ -z "$MUNGE_ENABLED" ] && systemctl enable munge.service
+ systemctl is-enabled munge.service || systemctl enable munge.service
echo -e "\e[34;1m==>\e[39;1m Starting munge.service... \e[0m"
- MUNGE_STARTED="$(systemctl | grep running | grep munge.service)"
- [ -z "$MUNGE_STARTED" ] && systemctl start munge.service
+ systemctl is-active munge.service || systemctl start munge.service
+
+ echo -e "\e[34;1m==>\e[39;1m Loading kernel modules... \e[0m"
+ [ -z "$(lsmod | grep ^squashfs)" ] && modprobe squashfs
+ [ -n "$(lsmod | grep ^squashfs)" ] && echo -e " \e[34;1m==>\e[39;1m squashfs... loaded\e[0m"
}
diff --git a/shifter-runtime.install b/shifter-runtime.install
index 4dd57f268c4f..677ac71fd2b5 100644
--- a/shifter-runtime.install
+++ b/shifter-runtime.install
@@ -1,13 +1,18 @@
post_install() {
+ post_upgrade
+
+ echo -e "\e[39;1m- Please make sure that the Shifter runtimes and the image gateway has the same munge key.\e[0m"
+ echo -e "\e[39;1m- Check the configuration file (/etc/shifter/udiRoot.conf) before pulling images or starting containers.\e[0m"
+}
+
+post_upgrade() {
systemctl daemon-reload
echo -e "\e[34;1m==>\e[39;1m Enabling munge.service... \e[0m"
- MUNGE_ENABLED="$(systemctl list-unit-files | grep enabled | grep munge.service)"
- [ -z "$MUNGE_ENABLED" ] && systemctl enable munge.service
+ systemctl is-enabled munge.service || systemctl enable munge.service
echo -e "\e[34;1m==>\e[39;1m Starting munge.service... \e[0m"
- MUNGE_STARTED="$(systemctl | grep running | grep munge.service)"
- [ -z "$MUNGE_STARTED" ] && systemctl start munge.service
+ systemctl is-active munge.service || systemctl start munge.service
echo -e "\e[34;1m==>\e[39;1m Copying /etc/passwd... \e[0m"
cp -f /etc/passwd /etc/shifter/shifter_etc_files/passwd
@@ -22,25 +27,6 @@ post_install() {
[ -n "$(lsmod | grep ^loop)" ] && echo -e " \e[34;1m==>\e[39;1m loop... loaded\e[0m"
[ -z "$(lsmod | grep ^squashfs)" ] && modprobe squashfs
[ -n "$(lsmod | grep ^squashfs)" ] && echo -e " \e[34;1m==>\e[39;1m squashfs... loaded\e[0m"
-
- echo -e "\e[39;1m- Please make sure that the Shifter runtimes and the image gateway has the same munge key.\e[0m"
- echo -e "\e[39;1m- Check the configuration file (/etc/shifter/udiRoot.conf) before pulling images or starting containers.\e[0m"
-}
-
-post_upgrade() {
- echo -e "\e[34;1m==>\e[39;1m Enabling munge.service... \e[0m"
- MUNGE_ENABLED="$(systemctl list-unit-files | grep enabled | grep munge.service)"
- [ -z "$MUNGE_ENABLED" ] && systemctl enable munge.service
-
- echo -e "\e[34;1m==>\e[39;1m Starting munge.service... \e[0m"
- MUNGE_STARTED="$(systemctl | grep running | grep munge.service)"
- [ -z "$MUNGE_STARTED" ] && systemctl start munge.service
-
- echo -e "\e[34;1m==>\e[39;1m Copying /etc/passwd... \e[0m"
- cp -f /etc/passwd /etc/shifter/shifter_etc_files/passwd
-
- echo -e "\e[34;1m==>\e[39;1m Copying /etc/group... \e[0m"
- cp -f /etc/group /etc/shifter/shifter_etc_files/group
}
pre_remove() {