Compare commits
	
		
			5 Commits
		
	
	
		
			d45ca0de96
			...
			d789c8e1b0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						d789c8e1b0
	
				 | 
					
					
						|||
| 
						
						
							
						
						e7e752f1e8
	
				 | 
					
					
						|||
| 
						
						
							
						
						094287837c
	
				 | 
					
					
						|||
| 
						
						
							
						
						a53f201842
	
				 | 
					
					
						|||
| 
						
						
							
						
						2ce1280cc0
	
				 | 
					
					
						
							
								
								
									
										13
									
								
								site.cfg
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								site.cfg
									
									
									
									
									
								
							@@ -2,10 +2,15 @@
 | 
			
		||||
# with the database.
 | 
			
		||||
# dbi:<driver name [SQLite, CSV, ADO, mSQL, etc.]>:<database name>
 | 
			
		||||
[DBI]
 | 
			
		||||
database: mysql
 | 
			
		||||
driver: dbi:mysql:database=hpr_hpr:hostname=localhost 
 | 
			
		||||
user: hpr-generator
 | 
			
		||||
password: zBozqN-Z2zNAz
 | 
			
		||||
# Configuration for SQLite (uncomment following settings)
 | 
			
		||||
#driver: dbi:SQLite:hpr.db 
 | 
			
		||||
#user: (unused -- leave blank)
 | 
			
		||||
#password: (unused -- leave blank)
 | 
			
		||||
# Configuration for MySQL (uncomment and update following settings)
 | 
			
		||||
#database: mysql
 | 
			
		||||
#driver: dbi:mysql:database=hpr_hpr:hostname=localhost 
 | 
			
		||||
#user: hpr-generator (suggested user with read only permissions)
 | 
			
		||||
#password: ********* (password created for user)
 | 
			
		||||
 | 
			
		||||
# Configure the root template page which pulls in the navigation and 
 | 
			
		||||
# content templates used by each page. An optional baseurl property may 
 | 
			
		||||
 
 | 
			
		||||
@@ -42,12 +42,15 @@ set -o nounset                              # Treat unset variables as an error
 | 
			
		||||
#       RETURNS: The path to the working directory 
 | 
			
		||||
#-------------------------------------------------------------------------------
 | 
			
		||||
function make_working_dir { 
 | 
			
		||||
 | 
			
		||||
	# the directory of the script
 | 
			
		||||
	DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 | 
			
		||||
	local DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 | 
			
		||||
 | 
			
		||||
	# the temp directory used, within $DIR
 | 
			
		||||
	# omit the -p parameter to create a temporal directory in the default location
 | 
			
		||||
	WORK_DIR=`mktemp -d -p "$DIR"`
 | 
			
		||||
	# omit the -p parameter to create a temporal directory in 
 | 
			
		||||
	# the default location
 | 
			
		||||
	
 | 
			
		||||
	local WORK_DIR=`mktemp -d -p "$DIR"`
 | 
			
		||||
 | 
			
		||||
	# check if tmp dir was created
 | 
			
		||||
	if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
 | 
			
		||||
@@ -55,7 +58,7 @@ function make_working_dir {
 | 
			
		||||
		exit 1
 | 
			
		||||
	fi
 | 
			
		||||
	echo $WORK_DIR
 | 
			
		||||
 }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#---  FUNCTION  ----------------------------------------------------------------
 | 
			
		||||
#          NAME:  clean_working_dir
 | 
			
		||||
@@ -64,11 +67,13 @@ function make_working_dir {
 | 
			
		||||
#       RETURNS:  
 | 
			
		||||
#-------------------------------------------------------------------------------
 | 
			
		||||
function clean_working_dir {
 | 
			
		||||
 | 
			
		||||
	if [[ -d $1  ]] && expr $1 : '.*/tmp.*' ; then
 | 
			
		||||
		rm -rf $1
 | 
			
		||||
		echo "Deleted temp working directory $1" 
 | 
			
		||||
	else
 | 
			
		||||
		echo "Not a temporary directory: $1"
 | 
			
		||||
		echo "Did not delete directory: $1"
 | 
			
		||||
		echo "Not a temporary directory."
 | 
			
		||||
	fi
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -96,15 +101,17 @@ function download_hpr_sql {
 | 
			
		||||
		echo "Removing temporary hpr.sql"
 | 
			
		||||
		rm $1/hpr.sql
 | 
			
		||||
	else
 | 
			
		||||
		echo "No temporary hpr.sql found"
 | 
			
		||||
		echo "No temporary hpr.sql to remove"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [ "$CURL" != "" ]; 
 | 
			
		||||
	then
 | 
			
		||||
		curl $HPR_URL --output $1/hpr.sql
 | 
			
		||||
		echo "Downloaded hpr.sql via curl"
 | 
			
		||||
	elif [ "$WGET" != "" ];
 | 
			
		||||
	then
 | 
			
		||||
		wget --directory-prefix=$1 $HPR_URL
 | 
			
		||||
		echo "Downloaded hpr.sql via wget"
 | 
			
		||||
	else
 | 
			
		||||
		echo "Could not download file. Please install either curl or wget."
 | 
			
		||||
		return 1
 | 
			
		||||
@@ -164,5 +171,14 @@ function make_hpr_sqlite_db {
 | 
			
		||||
#    PARAMETERS:  
 | 
			
		||||
#       RETURNS:  
 | 
			
		||||
#-------------------------------------------------------------------------------
 | 
			
		||||
function copy_to_public_dir { echo; }
 | 
			
		||||
function copy_to_public_dir { 
 | 
			
		||||
 | 
			
		||||
	if [ $# -gt 1 ] && [ ! -z "$1" ] && [ ! -z "$2" ];
 | 
			
		||||
	then
 | 
			
		||||
		cp $1/hpr.sql $2/hpr.sql
 | 
			
		||||
		cp $1/hpr.db $2/hpr.db
 | 
			
		||||
		return 0
 | 
			
		||||
	else 
 | 
			
		||||
		echo "Bad arguments. Can't copy files to public directory."
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user