[vhffs-dev] [svn] commit: r189 - in /trunk: INSTALL Makefile Relases.notes make_release2 vhffs-api/src/Vhffs/Group.pm vhffs-api/src/Vhffs/User.pm vhffs-backend/tools/vhffs-initdb |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [svn] commit: r189 - in /trunk: INSTALL Makefile Relases.notes make_release2 vhffs-api/src/Vhffs/Group.pm vhffs-api/src/Vhffs/User.pm vhffs-backend/tools/vhffs-initdb
- From: vhffs-dev@xxxxxxxxx
- Date: Mon, 01 May 2006 17:26:58 -0000
Author: soda
Date: Mon May 1 19:26:57 2006
New Revision: 189
Log:
fix initdb
Modified:
trunk/INSTALL
trunk/Makefile
trunk/Relases.notes
trunk/make_release2
trunk/vhffs-api/src/Vhffs/Group.pm
trunk/vhffs-api/src/Vhffs/User.pm
trunk/vhffs-backend/tools/vhffs-initdb
Modified: trunk/INSTALL
==============================================================================
--- trunk/INSTALL (original)
+++ trunk/INSTALL Mon May 1 19:26:57 2006
@@ -10,8 +10,9 @@
to install debian-packages to satisfy dependencies
2. Install VHFFS database : /usr/share/vhffs/backend/tools/vhffs-initdb
* You need a postgresql server
- * Invoke as /usr/share/vhffs/backend/tools/vhffs-initdb DATABASE SUPERUSER DBUSER
+ * Invoke as /usr/share/vhffs/backend/tools/vhffs-initdb DATABASE SUPERUSER DBUSER DBPASS
* SUPERUSER is the user who owns the postgresql server. See this user by running a ps axu|grep post
+ * DATABASE is the name of the VHFFS database, DBUSER the name of the user in the database server and DBPASS, its password
3. Configure the /etc/vhffs/vhffs.conf file
* Can be made before configure apache
4. Configure apache to enable panel
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Mon May 1 19:26:57 2006
@@ -130,6 +130,7 @@
install -m 755 vhffs-tools/src/vhffs-userinfo $(TOOLSDIR)/
install -m 755 vhffs-tools/src/vhffs-usermod $(TOOLSDIR)/
install -m 755 vhffs-tools/src/vhffs-webdir $(TOOLSDIR)/
+ install -m 755 vhffs-tools/src/vhffs-firstadmin $(TOOLSDIR)/
install-listengine-web:
Modified: trunk/Relases.notes
==============================================================================
--- trunk/Relases.notes (original)
+++ trunk/Relases.notes Mon May 1 19:26:57 2006
@@ -1,10 +1,20 @@
+Release Notes for 4.0:
+**********************
+* Of course, those notes are not so complete, and it is recommended
+ to get a look at http://www.vhffs.org
+
+
+***************************************************************
+***************************************************************
+***************************************************************
+
Release Notes for RC11:
***********************
* New installer. You don't have to use vhffs-install.sh script
use now make install. To get help on this installer, please
type make help
- * The domain for listengine is now in the configfile vhffs.conf
- See vhffs-backend/conf/vhffs.conf, at section <listengine>
+ * The vhffs-initdb script should work now
+
***************************************************************
Modified: trunk/make_release2
==============================================================================
--- trunk/make_release2 (original)
+++ trunk/make_release2 Mon May 1 19:26:57 2006
@@ -7,7 +7,7 @@
use File::Copy;
use IO::Handle;
-my $VERSION = "4.0rc10";
+my $VERSION = "4.0";
my @files_to_delete = qw(backup.sh fixperm.sh make_release make_release2 svn-commit);
my @files_to_package = qw( TODO Makefile Changelog AUTHORS vhffs-api vhffs-backend vhffs-doc vhffs-intl vhffs-listengine vhffs-panel vhffs-robots vhffs-shells debian vhffs-tools);
my $VERBOSE = 0;
Modified: trunk/vhffs-api/src/Vhffs/Group.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Group.pm Mon May 1 19:26:57 2006
@@ -167,6 +167,8 @@
my $query;
my $badgroups;
my $oid;
+ my $rows;
+ my $quota;
$self = shift;
@@ -196,7 +198,7 @@
#first, we check if the group doesn't exists
$query ="SELECT * FROM vhffs_groups WHERE groupname= '" .$self->{'groupname'}."'";
$request = $self->{'db'}->{'DB_READ'}->prepare( $query );
- my $rows = $request->execute;
+ $rows = $request->execute;
return -1 if ( $rows > 0 );
@@ -206,8 +208,17 @@
return -1 if ( $oid lt 0 );
- my $quota=10;
+
+ #Quota initialization
+ #One day, god decide that : "10Mb ? It will be enough for everyone"
+ # "God smoke too much herb"
+ $quota = 10;
$quota = $conf->{'default_quota'} if( ( defined $conf ) && ( defined $conf->{'default_quota'} ) );
+ $self->{'quota'} = $quota;
+ $self->{'quota_used'} = $quota;
+
+
+
# compute the gid
$self->{'gid'} = $conf->{'mingid'};
$result = $self->{'db'}->{'DB_READ'}->selectall_arrayref("SELECT MAX(gid) FROM vhffs_groups");
@@ -225,7 +236,6 @@
$request = $self->{'db'}->{'DB_WRITE'}->prepare($query) or return -2;
$request->execute() or return -3;
-
$self->commit;
return $self->{'gid'};
Modified: trunk/vhffs-api/src/Vhffs/User.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm (original)
+++ trunk/vhffs-api/src/Vhffs/User.pm Mon May 1 19:26:57 2006
@@ -263,12 +263,10 @@
$request = $self->{'db'}->{'DB_WRITE'}->prepare("INSERT INTO vhffs_users VALUES('" . $self->{'uid'} ."' , '3' , '$self->{'username'}' , '".$conf->{'shell'}."' , '' , '$homedir' , '".$self->{'admin'}."' , '$oid')");
-
$request->execute() or return -2;
$request = $self->{'db'}->{'DB_WRITE'}->prepare( "INSERT INTO vhffs_user_info VALUES( '". $self->{'uid'} ."' , now() , NULL , NULL , NULL , NULL , NULL, NULL, NULL , NULL)" );
-# $request = $self->{'db'}->{'DB_WRITE'}->prepare( "INSERT INTO vhffs_user_info VALUES( '". $self->{'uid'} ."' , now() , ' ' , ' ' , ' ' , ' ' ,' ' , ' ', ' ' , ' ')" );
$request->execute or return -2;
@@ -286,9 +284,8 @@
$request->execute or return -3;
$self->commit;
-
- #$self->commit;
- return $self->{'uid'};
+
+ return $self->{'uid'};
}
@@ -905,6 +902,8 @@
get_password( ) : returns the encrypted password
+set_password( $clear ) : set a new password. New password is given in the argument
+
get_uid( )
get_gid( )
Modified: trunk/vhffs-backend/tools/vhffs-initdb
==============================================================================
--- trunk/vhffs-backend/tools/vhffs-initdb (original)
+++ trunk/vhffs-backend/tools/vhffs-initdb Mon May 1 19:26:57 2006
@@ -4,16 +4,74 @@
#This script should be run with the identity of the postgres superuser
SCRIPTDIR="/usr/share/vhffs/backend/pgsql"
+LOGFILE="/dev/null"
+TMPFILE="/tmp/vhffs_pgsql"
FILES="create_object.sql create_object_history.sql create_acl.sql create_user.sql create_use_info.sql create_groups.sql create_groups_info.sql create_user_info.sql create_user_group.sql create_shadow_view.sql create_pass_view.sql create_panel_prefs.sql create_notes.sql create_mxdomain.sql create_boxes.sql create_forward.sql create_dns.sql create_cvs.sql create_ml.sql create_mysql.sql create_postgreql.sql create_svn.sql create_mailings.sql create_ml.sql create_confirmation.sql create_postgresql.sql create_httpd.sql"
DB=$1
PGUSER=$2
DBUSER=$3
+DBPASS=$4
+TABLES="
+vhffs_acl
+vhffs_boxes
+vhffs_confirmation
+vhffs_cvs
+vhffs_dns_global
+vhffs_dns_rr
+vhffs_dns_soa
+vhffs_forward
+vhffs_groups
+vhffs_groups_info
+vhffs_history
+vhffs_httpd
+vhffs_mailings
+vhffs_ml
+vhffs_ml_lang
+vhffs_ml_prefs
+vhffs_ml_subscribers
+vhffs_mxdomain
+vhffs_mysql
+vhffs_notes
+vhffs_object
+vhffs_panel_user_prefs
+vhffs_pgsql
+vhffs_svn
+vhffs_user_group
+vhffs_user_info
+vhffs_users
+"
+SEQUENCES="seq_id_acl
+seq_id_cvs
+seq_id_dns
+seq_id_groups
+seq_id_history
+seq_id_httpd
+seq_id_mailings
+seq_id_ml
+seq_id_mx
+seq_id_mysql
+seq_id_objects
+seq_id_pgsql
+seq_id_sub
+seq_id_svn
+seq_id_svn_users
+seq_id_user_group
+seq_id_users
+vhffs_confirmation_cid_seq
+vhffs_dns_rr_id_seq
+vhffs_dns_soa_id_seq
+vhffs_groups_gid_seq
+vhffs_mailings_id_mailing_seq
+vhffs_svn_svn_id_seq
+vhffs_users_uid_seq
+"
-if [ $# -ne 3 ]; then
- echo "Error should invoke as vhffs-initdb DATABASE SUPERUSER DBUSER"
+if [ $# -ne 4 ]; then
+ echo "Error should invoke as vhffs-initdb DATABASE SUPERUSER DBUSER DBPASS"
echo "DATABASE is the name of your VHFFS database"
echo "SUPERUSER is the name of the unix-user who runs the PostgreSQL server"
echo "DBUSER is the future name of the PostgreSQL user, will be created by this script"
+ echo "DBPASS is the password for the PostgreSQL user"
exit 1
fi
@@ -23,30 +81,62 @@
fi
-echo "Remove old users and databases and create new ones"
-su $PGUSER "dropdb $DB" 2>/dev/null 1>&2
+echo "* Remove old users and databases and create new ones"
+echo "dropdb $DB" | su $PGUSER 2>>$LOGFILE 1>&2
if [ $? -ne 0 ]; then
echo "Warning: error while delete old database, maybe it was not delete"
fi
-su $PGUSER "dropuser $DBUSER" 2>/dev/null 1>&2
+echo "dropuser $DBUSER" | su $PGUSER 2>>$LOGFILE 1>&2
if [ $? -ne 0 ]; then
echo "Warning: error while delete old VHFFS database user"
fi
-su $PGUSER "createuser -D -A $DBUSER" 2>/dev/null 1>&2
-su $PGUSER "createdb -O $DBUSER $DB" 2>/dev/null 1>&2
+echo -n "* Create users and database ... "
+echo "createuser -q -D -R -A $DBUSER" | su $PGUSER 2>>$LOGFILE 1>&2
+echo "createdb -O $DBUSER $DB" | su $PGUSER 2>>$LOGFILE 1>&2
+echo "done"
-echo -n "Create database: "
-for v in $FILES; do
- su $PGUSER "psql -f $SCRIPTDIR/$v $DB" 2>/dev/null 1>&2
- echo -n "$v "
-done
-echo " ... done"
+echo -n "* Change password for the user ..."
+ echo "ALTER USER $DBUSER WITH PASSWORD '$DBPASS'" > $TMPFILE
+ echo "psql -f $TMPFILE $DB" | su $PGUSER 2>>$LOGFILE 1>&2
+ rm -rf $TMPFILE
+echo "done"
-echo "Don't forget to create user permission for postgresql access in the pg_hba.conf file."
-echo "Thanks for using VHFFS platform"
+echo "* Create database: "
+for v in $FILES; do
+ echo " $v "
+ echo "psql -f $SCRIPTDIR/$v $DB" | su $PGUSER 2>>$LOGFILE 1>&2
+done
+
+echo -n "* Update permissions, allow user $DBUSER to access on $DB ..."
+ echo "GRANT ALL ON DATABASE $DB TO $DBUSER" > $TMPFILE
+ echo "psql -f $TMPFILE $DB" | su $PGUSER 2>>$LOGFILE 1>&2
+ rm -f $TMPFILE
+
+ for v in $TABLES; do
+ echo "ALTER TABLE $v OWNER TO $DBUSER" > $TMPFILE
+ echo "psql -f $TMPFILE $DB" | su $PGUSER 2>>$LOGFILE 1>&2
+ rm -f $TMPFILE
+ done
+
+ for v in $SEQUENCES; do
+ echo "ALTER TABLE $v OWNER TO $DBUSER" > $TMPFILE
+ echo "psql -f $TMPFILE $DB" | su $PGUSER 2>>$LOGFILE 1>&2
+ rm -f $TMPFILE
+ done
+
+echo "done"
+
+
+echo ""
+echo " / \ Don't forget : you have to create"
+echo " / ! \ entries in the pg_hba.conf file for"
+echo " /_____\ the user $DBUSER for database $DB"
+echo ""
+echo ""
+echo " Thanks for using VHFFS platform"
exit 0