aboutsummaryrefslogtreecommitdiff
path: root/news/ifmail/pkg-install
diff options
context:
space:
mode:
Diffstat (limited to 'news/ifmail/pkg-install')
-rw-r--r--news/ifmail/pkg-install26
1 files changed, 24 insertions, 2 deletions
diff --git a/news/ifmail/pkg-install b/news/ifmail/pkg-install
index ebadbb12da31..ae00c1fd5e68 100644
--- a/news/ifmail/pkg-install
+++ b/news/ifmail/pkg-install
@@ -2,6 +2,7 @@
user=ifmail
group=uucp
+uid=70
ask() {
local question default answer
@@ -56,8 +57,29 @@ EOF
else
echo "You need a user \"${user}\"."
if which -s pw && yesno "Would you like me to create it" y; then
- pw useradd ${user} -g ${group} -h - -d /nonexistent \
- -s /nonexistent -c "Ifmail user" || exit
+ if [ `id -u` -ne 0 ]; then
+ echo "You must be root to add the user."
+ exit 1
+ fi
+ if pw user show ${uid} >/dev/null 2>&1; then
+ echo "The ifmail user is normally UID ${uid}. However, you currently have"
+ echo "a UID ${uid}."
+ if yesno "Should I just pick a new UID" y; then
+ while pw user show ${uid} >/dev/null 2>&1; do
+ uid=`expr ${uid} + 1`
+ done
+ if [ $uid -gt 99 ]; then
+ echo "I can't find a low UID to use. Please create an 'ifmail' user"
+ echo "and try the installation again."
+ exit 1
+ fi
+ else
+ exit 1
+ fi
+ echo "Ok, I'll use UID ${uid}."
+ fi
+ pw useradd ${user} -g ${group} -u ${uid} -h - -d /nonexistent \
+ -s /nonexistent -c "Ifmail user" || exit 1
echo "Done."
else
echo "Please create it, and try again."