--- ./lib/url.php~ 2005-12-26 23:23:03.000000000 +0200 +++ ./lib/url.php 2006-01-27 00:45:58.479261981 +0200 @@ -17,7 +17,7 @@ $currentFile = __FILE__; if ( $currentFile == '/usr/share/gallery/lib/url.php') { /* We assum Gallery runs on as Debian Package */ - define ("GALLERY_CONFDIR", "/etc/gallery"); + define ("GALLERY_CONFDIR", "/usr/share/gallery"); define ("GALLERY_SETUPDIR", "/var/lib/gallery/setup"); } else { define ("GALLERY_CONFDIR", dirname(dirname(__FILE__))); --- gallery/setup/config_data.inc 2006-01-10 07:41:32.000000000 +0200 +++ /tmp/config_data.inc 2006-01-27 00:53:36.000000000 +0200 @@ -317,7 +317,7 @@ 'desc' => '(' . gTranslate('config',"REQUIRED") . ') ' . sprintf(gTranslate('config',"The full path on physical disk to the directory where your photos will be stored. This directory should start off empty—Gallery will fill it. Note that this directory needs to have write access by the user who is running the web server (in your case this user is %s)."), ''. $webserver_user . ''), - 'value' => getenv('DOCUMENT_ROOT') . '/albums', + 'value' => '/var/lib/gallery/albums', 'require-write-dir' => 1, 'filename' => 1, 'type' => 'text', @@ -330,7 +330,7 @@ 'desc' => '(' . gTranslate('config',"REQUIRED") . ') ' . sprintf(gTranslate('config',"The filesystem path to a temporary directory. E.g. %s or %s. Note that if you have open_basedir configured on your system, then this temporary directory must be inside the open_basedir path! In that case you may need to create the directory yourself and make sure that it's writable by the webserver process."), '/tmp','c:\\windows\\temp'), - 'value' => getenv('TMP'), + 'value' => '/var/tmp', 'filename' => 1, 'require-write-dir' => 1, 'type' => 'text', --- gallery/setup/config_data.inc 2006-01-27 01:22:22.000000000 +0200 +++ /tmp/config_data.inc 2006-01-27 01:38:25.000000000 +0200 @@ -354,7 +354,7 @@ 'desc' => '(' . gTranslate('config',"REQUIRED") . ') ' . sprintf(gTranslate('config',"The full URL to your album directory on your web server. (e.g. %s) Gallery can operate with relative URLs, however some features, such as printing, may not function correctly."), 'http://www.example.com/albums'), - 'value' => 'http://' . getenv('SERVER_NAME') . '/albums', + 'value' => 'http://' . getenv('SERVER_NAME') . $GALLERY_URL . '/albums', 'no-trailing-slash' => 1, 'type' => 'text', 'attrs' => array('size' => 50), --- gallery-1.5.2.orig/configure.sh +++ gallery-1.5.2/configure.sh @@ -1,20 +1,28 @@ #!/bin/sh -# $Id$ -chmod 755 setup +set -e -if [ ! -f config.php ]; then - touch config.php -fi +ROOT=/usr/share/gallery +CONFDIR=/etc/webapps/gallery -if [ ! -f .htaccess ]; then - touch .htaccess +if [ `whoami` != "root" ] ; then + echo "You must be root to run this script" 2>&1 + exit 1 fi -chmod 666 config.php .htaccess +for file in $CONFDIR/config.php $CONFDIR/htaccess ; do + if [ ! -f $file ]; then + touch $file + fi + chown root:http $file + chmod 660 $file +done + +chmod 755 $ROOT/setup + echo "" -echo "You are now in setup mode. Your Gallery installation" +echo "You are now in setup mode. Your Gallery installation" echo "can be configured by pointing your web browser" -echo "to the URL to 'setup' in this directory." +echo "to the setup wizard (e.g. http://www.example.com/gallery/setup/index.php) " echo "" --- gallery-1.5.2.orig/secure.sh +++ gallery-1.5.2/secure.sh @@ -1,21 +1,31 @@ #!/bin/sh -# $Id$ +# $Id$ -if [ -f config.php ]; then - chmod 644 config.php -fi -if [ -f .htaccess ]; then - chmod 644 .htaccess +set -e + +ROOT=/usr/share/gallery +CONFDIR=/etc/webapps/gallery + +if [ `whoami` != "root" ] ; then + echo "You must be root to run this script" 2>&1 + exit 1 fi -if [ -f setup/resetadmin ]; then - rm -f setup/resetadmin +for file in $CONFDIR/config.php $CONFDIR/htaccess ; do + if [ -f $file ]; then + chown root:http $file + chmod 640 $file + fi +done + +if [ -f $ROOT/setup/resetadmin ]; then + rm -f $ROOT/setup/resetadmin fi echo "" echo "Your Gallery is now secure and cannot be configured. If" -echo "you wish to reconfigure it, run:" +echo "you wish to reconfigure it, run configure.sh as root:" echo "" -echo " % ./configure.sh" +echo " # $ROOT/configure.sh" echo "" --- gallery-1.5.2.orig/setup/confirm.inc +++ gallery-1.5.2/setup/confirm.inc @@ -53,7 +53,7 @@ ${str_replace('.', '', $outfile) . '_file'} = 0; } else { $error++; - $viewheader .= '
'. gallery_error(sprintf(_("File %s is not writable by the webserver - chmod it 777 before proceeding. See %s for more details."), "$outfile", $docs)) . "

\n"; + $viewheader .= gallery_error(sprintf(_("File %s is not writable by the webserver - run %s before proceeding. See %s for more details."), "$outfile", "/usr/share/gallery/configure.sh", $docs)) . "

\n"; ${str_replace('.', '', $outfile) . '_file'} = 1; } } --- gallery-1.5.2.orig/setup/write.inc +++ gallery-1.5.2/setup/write.inc @@ -193,7 +193,7 @@ $message .= "

"; else $message = ""; - $message .= _("We highly suggest that you run 'secure.sh', or chmod your .htaccess and config.php to 644 for increased security."); + $message .= _("We highly suggest that you run '/usr/share/gallery/secure.sh' for increased security."); } // Inform the user that their gallery is not secure until they remove the 'resetadmin' file