summarylogtreecommitdiffstats
path: root/aegir.install
diff options
context:
space:
mode:
authorJames An2015-11-11 11:02:36 -0500
committerJames An2015-11-11 11:02:36 -0500
commit3c79b0e3615722148bfc73b063b7964c1150a581 (patch)
treeb1570ffc15fb12dbc2e09f75cc4f3c329527f26d /aegir.install
parent2cdf4c350f2ad311644770d008f25021e9a2ecb2 (diff)
downloadaur-3c79b0e3615722148bfc73b063b7964c1150a581.tar.gz
Changed install file to create aegir user on both package install and upgrade.
Diffstat (limited to 'aegir.install')
-rw-r--r--aegir.install26
1 files changed, 14 insertions, 12 deletions
diff --git a/aegir.install b/aegir.install
index 70470f1d2e19..a34b1c49dc51 100644
--- a/aegir.install
+++ b/aegir.install
@@ -1,16 +1,6 @@
post_install() {
- echo -n ">>> Creating the aegir user as an alias of the http user... "
- [ $(getent passwd aegir &>/dev/null; echo $?) -eq 0 ] && {
- echo "User already exists; no action taken."
- } || {
- useradd --gid $(id --group http) --home-dir /usr/share/webapps/aegir --non-unique --uid $(id --user http) aegir
- # Replace /etc/passwd with itself having the Aegir user rearranged above the HTTP user.
- tempfile=$(mktemp)
- cat <(sed -n '1,/^http/p' /etc/passwd | head -n-1) <(getent passwd aegir) <(sed -n '/^http/,$p' /etc/passwd | head -n-1) >| $tempfile
- install -m644 $tempfile /etc/passwd
- echo "Done."
- }
-
+ post_upgrade
+
echo -n ">>> Testing that localhost resolves to an IP address assigned to a network interface... "
[ $(ip addr | sed --quiet --regexp-extended 's/\s+inet6?\s([^\/]*).*/\1/p' | egrep '^(127.0.0.1|::1)$' | wc -l) -eq 0 ] && echo "Failed." || echo "Passed."
@@ -52,6 +42,18 @@ pre_upgrade() {
}
post_upgrade() {
+ echo -n ">>> Creating the aegir user as an alias of the http user... "
+ [ $(getent passwd aegir &>/dev/null; echo $?) -eq 0 ] && {
+ echo "User already exists; no action taken."
+ } || {
+ useradd --gid $(id --group http) --home-dir /usr/share/webapps/aegir --non-unique --uid $(id --user http) aegir
+ # Replace /etc/passwd with itself having the Aegir user rearranged above the HTTP user.
+ tempfile=$(mktemp)
+ cat <(sed -n '1,/^http/p' /etc/passwd | head -n-1) <(getent passwd aegir) <(sed -n '/^http/,$p' /etc/passwd | head -n-1) >| $tempfile
+ install -m644 $tempfile /etc/passwd
+ echo "Done."
+ }
+
[ -f /tmp/aegir.target-active ] && {
rm /tmp/aegir.target-active
systemctl --system stop --now aegir.target