summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Polstra <jdp@FreeBSD.org>2000-02-11 04:26:59 +0000
committerJohn Polstra <jdp@FreeBSD.org>2000-02-11 04:26:59 +0000
commit7c45758b34406054770a7bb69c9dc850d7897f9d (patch)
tree46cecb9ccef3713c9d97af5c895d437e59881a66
parentAdd WWW link (diff)
DEINSTALL: Offer to kill all running cvsupd processes. Remind
the user to remove the client's home directory and the mirrored files. INSTALL: Create a home directory for the client user, since one is needed to hold the authentication key file. Also create an empty "auth" file so that its permissions will be right. Set the gcos fields more appropriately.
Notes
Notes: svn path=/head/; revision=25655
-rw-r--r--net/cvsup-mirror/pkg-deinstall16
-rw-r--r--net/cvsup-mirror/pkg-install30
2 files changed, 38 insertions, 8 deletions
diff --git a/net/cvsup-mirror/pkg-deinstall b/net/cvsup-mirror/pkg-deinstall
index 7e79cc31460c..de1a3a908617 100644
--- a/net/cvsup-mirror/pkg-deinstall
+++ b/net/cvsup-mirror/pkg-deinstall
@@ -30,7 +30,7 @@ yesno() {
}
delete_account() {
- local u g
+ local u g home
u=$1
g=$2
@@ -39,8 +39,13 @@ delete_account() {
echo "Done."
fi
if yesno "Do you want me to remove user \"${u}\"" y; then
+ eval home=~${u}
pw userdel -n ${u}
echo "Done."
+ if [ -d "${home}" ]; then
+ echo "Please remember to remove the home directory \"${home}\" as"
+ echo "well as the mirrored files."
+ fi
fi
}
@@ -55,8 +60,13 @@ base=${PKG_PREFIX}/etc/cvsup
. ${base}/config.sh || exit
if ps -axc | grep -q cvsupd; then
- echo "Please kill your running cvsupd processes first" >&2
- exit 1
+ if yesno "There are some cvsupd processes running. Shall I kill them" y
+ then
+ killall cvsupd
+ sleep 2
+ else
+ echo "OK ... I hope you know what you are doing."
+ fi
fi
tmp="/etc/#cvsma$$"
diff --git a/net/cvsup-mirror/pkg-install b/net/cvsup-mirror/pkg-install
index 84c018fd5d1d..98e6940d3d70 100644
--- a/net/cvsup-mirror/pkg-install
+++ b/net/cvsup-mirror/pkg-install
@@ -73,10 +73,13 @@ EOF
}
make_account() {
- local u g
+ local u g gcos homeopt home
u=$1
g=$2
+ gcos=$3
+ homeopt=${4:+"-d $4"}
+
if pw group show "${g}" >/dev/null 2>&1; then
echo "You already have a group \"${g}\", so I will use it."
else
@@ -99,14 +102,31 @@ make_account() {
else
echo "You need a user \"${u}\"."
if which -s pw && yesno "Would you like me to create it" y; then
- pw useradd ${u} -g ${g} -h - -d /nonexistent \
- -s /nonexistent -c "CVSup Daemon" || exit
+ pw useradd ${u} -g ${g} -h - ${homeopt} \
+ -s /nonexistent -c "${gcos}" || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
+
+ if [ x"$homeopt" = x ]; then
+ eval home=~${u}
+ if [ ! -d "${home}" ]; then
+ if yesno \
+ "Would you like me to create ${u}'s home directory (${home})" y
+ then
+ (umask 77 && \
+ mkdir -p ${home}/.cvsup && \
+ touch ${home}/.cvsup/auth) || exit
+ chown -R ${u}:${g} ${home} || exit
+ else
+ echo "Please create it, and try again."
+ exit 1
+ fi
+ fi
+ fi
}
case $2 in
@@ -132,8 +152,8 @@ EOF
fi
echo ""
- make_account ${user} ${group}
- make_account ${cuser} ${cgroup}
+ make_account ${user} ${group} "CVSup Daemon" "/nonexistent"
+ make_account ${cuser} ${cgroup} "CVSup Client"
echo "Fixing ownerships and modes in \"${base}\"."
chown -R root:wheel ${base}