[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ToutDoux-list] Re: (no subject)
From: |
mathieu |
Subject: |
[ToutDoux-list] Re: (no subject) |
Date: |
Thu, 04 Oct 2001 17:54:26 +0200 (MEST) |
User-agent: |
IMP/PHP IMAP webmail program 2.2.42 |
comme ça tirait une drole de gueule dans l'archive, je renvoie initpgsql-
first_time.sh
#!/bin/sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
SNAME="initpgsql-first_time"
SVER="14 oct 2001"
# configuration
PGSQLUSER="postgres"
INITTAB="/etc/inittab"
# functions
# infos
function version {
echo "$SNAME - $SVER"
echo ""
echo "Copyright (c) 2001 Mathieu ROY <address@hidden>"
echo "This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE."
}
# work
function check_pgsqluser {
# what is the pgsql user ?
echo "Is \`$PGSQLUSER\` the name of the posgreSQL admin user ? (y/n)"
read ECHO
# if the var PGSQLUSER is not well defined, question the user
if [ "$ECHO" != "y" ] ; then
echo "Type the name of the posgreSQL admin user:"
read PGSQLUSER
check_pgsqluser
fi
}
function update_inittab {
# update /etc/inittab ($INITTAB) to get postmaster started at station
init
# check if user want this
echo "Should I add an entry in $INITTAB so the station start postgreSQL
at init ? (y/n)"
read ECHO
if [ "$ECHO" == "y" ] ; then
# make a backup
cp -f $INITTAB $INITTAB.$SNAME.old
# update $INITTAB
echo "# added by $SNAME, on `date` ; start pgsql at boot time" >>
$INITTAB
echo "pg:2345:respawn:/bin/su - $PGSQLUSER -c \"postmaster\"" >>
$INITTAB
fi
}
function start_pgsql {
su $PGSQLUSER -c "postmaster" &
}
function initdb_pgsql {
# database init
su $PGSQLUSER -c "initdb"
}
function createuser_pgsql {
# get normal user ID
echo "Type the name of a normal user (neither root or $PGSQLUSER that
should use postgreSQL ? (basically, should be your proper user)"
read CUSER
echo "Now, postgreSQL will question you 2 times."
echo "To use toutdoux, your user should be able to create database."
echo "To use toutdoux, your user dont need to be allowed to create more
users."
su $PGSQLUSER -c "createuser $CUSER"
echo "Do you want creating another one user ? (y/n)"
read ECHO
if [ "$ECHO" == "y" ] ; then
createuser_pgsql
fi
}
# go !
case $1 in
--version | -v ) version ;;
*)
check_pgsqluser
update_inittab
start_pgsql
initdb_pgsql
createuser_pgsql
;;
esac
# end
En réponse à mathieu <address@hidden>:
> voila le script à faire executer par le make install lorsque pgsql est
> choisi à
> la fin de l'install.
> éventuellement, demander à l'utilisateur s'il veut initialiser pgsql
> (parce
> qu'il c'est déjà fait, pas la peine
>
>
> initpgsql-first_time.sh
>
> --
> mathieu
>
> /* http://yeupou.free.fr/ */
--
mathieu
/* http://yeupou.free.fr/ */