X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=packaging%2Ffreebsd%2Fpkg-install;h=d7e4dbec95acffd9ab5c7387975f29906f1b4760;hb=4885662fcaaad9a065a5ef43e0e243609ee8ac60;hp=b832190c37708eb96e712bc063b4fe2fb87e321a;hpb=6a68ed330a5133d4d4d3aa7ae0c9c26bb7a7e59b;p=monkeysphere.git diff --git a/packaging/freebsd/pkg-install b/packaging/freebsd/pkg-install index b832190..d7e4dbe 100755 --- a/packaging/freebsd/pkg-install +++ b/packaging/freebsd/pkg-install @@ -15,6 +15,7 @@ # MySQL puts its data in /var/db/mysql VARLIB="/var/monkeysphere" +ETCDIR="/usr/local/etc/monkeysphere" case $2 in POST-INSTALL) @@ -22,8 +23,9 @@ POST-INSTALL) GROUP=${USER} UID=641 GID=${UID} + SHELL=/usr/local/bin/bash - if pw group show "${GROUP}" 2>/dev/null; then + if pw group show "${GROUP}" >/dev/null 2>&1; then echo "You already have a group \"${GROUP}\", so I will use it." else if pw groupadd ${GROUP} -g ${GID}; then @@ -34,11 +36,19 @@ POST-INSTALL) fi fi - if pw user show "${USER}" 2>/dev/null; then - echo "You already have a user \"${USER}\", so I will use it." + if pw user show "${USER}" >/dev/null 2>&1; then + oldshell=`pw user show "${USER}" 2>/dev/null | cut -f10 -d:` + if [ x"$oldshell" != x"$SHELL" ]; then + echo "You already have a \"${USER}\" user, but its shell is '$oldshell'." + echo "This package requires that \"${USER}\"'s shell be '$SHELL'." + echo "You should fix this by hand and then re-install the package." + echo " hint: pw usermod '$USER' -s '$SHELL'" + exit 1 + fi + echo "You already have a user \"${USER}\" with the proper shell, so I will use it." else if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -d "$VARLIB" -s /bin/sh -c "monkeysphere authentication user,,," + -d "$VARLIB" -s /usr/local/bin/bash -c "monkeysphere authentication user,,," then echo "Added user \"${USER}\"." else @@ -47,21 +57,16 @@ POST-INSTALL) fi fi - ## set up the cache directories: + ## set up the cache directories, and link them to the config files: install -d -o root -g monkeysphere -m 750 "$VARLIB"/gnupg-host - cat < "$VARLIB"/gnupg-host/gpg.conf -list-options show-uid-validity -EOF + ln -sf "$ETCDIR"/gnupg-host.conf "$VARLIB"/gnupg-host/gpg.conf install -d -o monkeysphere -g monkeysphere -m 700 "$VARLIB"/gnupg-authentication -# install authentication gpg.conf - cat < "$VARLIB"/gnupg-authentication/gpg.conf -list-options show-uid-validity -primary-keyring $VARLIB/gnupg-authentication/pubring.gpg -keyring $VARLIB/gnupg-host/pubring.gpg -EOF + ln -sf "$ETCDIR"/gnupg-authentication.conf "$VARLIB"/gnupg-authentication/gpg.conf + chown monkeysphere:monkeysphere "$VARLIB"/gnupg-authentication/gpg.conf + monkeysphere-server diagnostics ;; esac