Skip to content
Browse files

close issue #17 and improve fix of issue #12

  • Loading branch information...
1 parent 838ea00 commit 60c9196bfa38d08a9d08cffb52b3895bc97a9e91 Christopher Valles committed Oct 9, 2011
Showing with 55 additions and 26 deletions.
  1. +13 −2 bin/zfs.sh
  2. +39 −21 scripts/install.sh
  3. +3 −3 scripts/migrations/001-BackofficeUsers.php
View
15 bin/zfs.sh
@@ -1,7 +1,18 @@
#!/bin/sh
+# Get current foldername
+currentFolder=`basename \`pwd\``
+
+# Check if we are executing the script inside scripts folder or in the root folder
+if [ $currentFolder == "bin" ] ; then
+ echo "You must run this script from the root folder"
+ exit 1
+else
+ prefix='./'
+fi
+
# add the directory to include_path
-ZF_CONFIG_FILE='./zf.ini'
+ZF_CONFIG_FILE='bin/zf.ini'
export ZF_CONFIG_FILE
# zf.sh call
-./zf.sh $@
+./bin/zf.sh $@
View
60 scripts/install.sh
@@ -17,6 +17,9 @@ else
prefix='./'
fi
+ZF_CONFIG_FILE='${prefix}bin/zf.ini'
+export ZF_CONFIG_FILE
+
# Create a few folders
echo "- Creating log folders"
if [ ! -d "${prefix}logs" ]; then
@@ -65,23 +68,44 @@ read -p " Database password: " dbPassword
read -p " Database host (ip or hostname) [localhost]: " dbHost
# Getting security parameters from the user
-if [ -n "`which md5`" ]; then
- md5Command=`which md5`
-elif [ -n "`which md5pass`" ]; then
- md5Command=`which md5pass`
+if [ -n "`which md5`" -o -n "`which md5sum`" ]; then
+ if [ -n "`which md5`" ]; then
+ csrfSaltRandom=`md5 -qs $RANDOM`
+ frontendSaltRandom=`md5 -qs $RANDOM`
+ backofficeSaltRandom=`md5 -qs $RANDOM`
+ fi
+
+ if [ -n "`which md5sum`" ]; then
+ csrfSaltRandom=`echo $RANDOM | md5sum | cut -d' ' -f1`
+ frontendSaltRandom=`echo $RANDOM | md5sum | cut -d' ' -f1`
+ backofficeSaltRandom=`echo $RANDOM | md5sum | cut -d' ' -f1`
+ fi
+
+ echo " [SECURITY]"
+ read -p " Salt for anti-CSRF tokens [$csrfSaltRandom]: " csrfSalt
+ read -p " Salt for the frontend passwords [$frontendSaltRandom]: " frontendSalt
+ read -p " Salt for the backoffice passwords [$backofficeSaltRandom]: " backofficeSalt
+
else
- read -p "Unable to find a utility to generate md5 hashes. Please specify the path to the md5 binary: " md5Command
+ echo "Unable to find a utility to generate md5 hashes."
+
+ echo " [SECURITY]"
+ while [ -z "$csrfSalt" ]
+ do
+ read -p " Specify a salt for anti-CSRF tokens: " csrfSalt
+ done
+
+ while [ -z "$frontendSalt" ]
+ do
+ read -p " Specify a salt for the frontend passwords: " frontendSalt
+ done
+
+ while [ -z "$backofficeSalt" ]
+ do
+ read -p " Specify a salt for the backoffice passwords: " backofficeSalt
+ done
fi
-csrfSaltRandom=`$md5Command -qs $RANDOM`
-frontendSaltRandom=`$md5Command -qs $RANDOM`
-backofficeSaltRandom=`$md5Command -qs $RANDOM`
-
-echo " [SECURITY]"
-read -p " Salt for anti-CSRF tokens [$csrfSaltRandom]: " csrfSalt
-read -p " Salt for the frontend passwords [$frontendSaltRandom]: " frontendSalt
-read -p " Salt for the backoffice passwords [$backofficeSaltRandom]: " backofficeSalt
-
# Getting the backoffice credentials
backofficePasswordRandom=`md5 -qs $RANDOM | cut -c1-8`
backofficeEmailRandom=${RANDOM}@mailinator.com
@@ -159,14 +183,8 @@ echo "- Giving permissions to log and cache folders"
chmod -R 777 "${prefix}logs"
chmod -R 777 "${prefix}cache"
-# Install the AkRabat migration tool
-#echo "- Installing AkRabat migration tool"
-#${prefix}bin/zf.sh --setup storage-directory
-#${prefix}bin/zf.sh --setup config-file
-#echo 'basicloader.classes.0 = "Akrabat_Tool_DatabaseSchemaProvider"' > ~/.zf.ini
-
# Run the migrations
echo "- Running the DB migrations"
-${prefix}bin/zfs.sh update database-schema
+${prefix}bin/zf.sh update database-schema
echo -e "\nInstallation finished"
View
6 scripts/migrations/001-BackofficeUsers.php
@@ -9,9 +9,9 @@
class BackofficeUsers extends Akrabat_Db_Schema_AbstractChange
{
public function up(){
- $username = '';
- $password = sha1('');
- $email = '';
+ $username = 'john.doe';
+ $password = sha1('1c628154a44069042e4b326df79fd38fw384dm1n');
+ $email = '15151@mailinator.com';
$sql = "CREATE TABLE `backoffice_users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,

0 comments on commit 60c9196

Please sign in to comment.
Something went wrong with that request. Please try again.