diff options
author | Thierry Thomas <thierry@FreeBSD.org> | 2004-05-20 16:29:49 +0000 |
---|---|---|
committer | Thierry Thomas <thierry@FreeBSD.org> | 2004-05-20 16:29:49 +0000 |
commit | d8ef2d011153327a259cfbc742fd1cedf85e466e (patch) | |
tree | 438500223e75917ccb6e2f6ef624c99b4801b747 /databases/phpmyadmin211/pkg-install-suphp | |
parent | 0e8d24bf420689751b8dc250b796756b88b6dcef (diff) | |
download | ports-d8ef2d011153327a259cfbc742fd1cedf85e466e.tar.gz ports-d8ef2d011153327a259cfbc742fd1cedf85e466e.zip |
Notes
Diffstat (limited to 'databases/phpmyadmin211/pkg-install-suphp')
-rw-r--r-- | databases/phpmyadmin211/pkg-install-suphp | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/databases/phpmyadmin211/pkg-install-suphp b/databases/phpmyadmin211/pkg-install-suphp new file mode 100644 index 000000000000..7bdf484e65ed --- /dev/null +++ b/databases/phpmyadmin211/pkg-install-suphp @@ -0,0 +1,98 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +PATH=/usr/sbin:/usr/bin:/bin ; export PATH + +myadmdir=%%PREFIX%%/%%MYADMDIR%% +myadmusr=%%MYADMUSR%% +myadmgrp=%%MYADMGRP%% + +myadmgcos="phpMyAdmin Owner" +myadmhome=/nonexistent +myadmshell=/sbin/nologin + +create_group() { + local user group gcos home shell + + user=$1 + group=$2 + gcos=$3 + home=$4 + shell=$5 + + if pw groupadd -n $group ; then + echo "===> Group $group created" + else + cat <<-EOERRORMSG + *** Failed to create the $group group. + + Please add the $user user and $group group + manually with the commands: + + pw groupadd -n $group + pw useradd -n $user -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi +} + + +create_user() { + local user group gcos home shell + + user=$1 + group=$2 + gcos=$3 + home=$4 + shell=$5 + + if pw useradd -n $user -g $group -c "$gcos" -d $home -s $shell -h - ; then + echo "===> Created $user user" + else + cat <<-EOERRORMSG + *** Failed to create the $user user. + + Please add the $user user manually with the command: + + pw useradd -n $user -g $group -c "$gcos" \\ + -d $home -s $shell -h - + + and retry installing this package. + EOERRORMSG + exit 1 + fi +} + + +case $2 in + PRE-INSTALL) + + # Create the myadm user and group if they do not already exist + + if pw user show -n $myadmusr >/dev/null 2>&1 ; then + echo "===> Using pre-existing user $myadmusr" + else + if ! pw group show -n $myadmgrp >/dev/null 2>&1 ; then + create_group $myadmusr $myadmgrp "$myadmgcos" $myadmhome \ + $myadmshell + fi + create_user $myadmusr $myadmgrp "$myadmgcos" $myadmhome $myadmshell + fi + ;; + POST-INSTALL) + + # Change ownership of the phpMyAdm directory + + echo "===> Adjusting file ownership in $myadmdir" + chown -R $myadmusr:$myadmgrp $myadmdir || exit 1 + ;; +esac + +# +# That's All Folks! +# |