summarylogtreecommitdiffstats
path: root/shifter-runtime.install
blob: 4dd57f268c4f5d81fd4c504d3718a7ac0436fd7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
post_install() {
	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

	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

	echo -e "\e[34;1m==>\e[39;1m Loading kernel modules... \e[0m"
	[ -z "$(lsmod | grep ^ext4)" ] && modprobe ext4
	[ -n "$(lsmod | grep ^ext4)" ] && echo -e "    \e[34;1m==>\e[39;1m ext4... loaded\e[0m"
	[ -z "$(lsmod | grep ^loop)" ] && modprobe loop
	[ -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() {
	echo -e "\e[34;1m==>\e[39;1m Deleting /etc/shifter/shifter_etc_files/passwd... \e[0m"
	rm -f /etc/shifter/shifter_etc_files/passwd

	echo -e "\e[34;1m==>\e[39;1m Deleting /etc/shifter/shifter_etc_files/group... \e[0m"
	rm -f /etc/shifter/shifter_etc_files/group
}