mirror of
https://github.com/oupala/apaxy.git
synced 2025-09-18 23:31:27 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5651afb5ef | ||
|
8ca6129404 | ||
|
6ccfb40ce2 | ||
|
aae02e06fe | ||
|
8f85f2c8ab | ||
|
8f7897495f | ||
|
ca63ea21a8 |
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,3 +1,21 @@
|
|||||||
|
## [2.1.1](https://github.com/oupala/apaxy/compare/2.1.0...2.1.1) (2019-06-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* improve cli parameters management ([8ca6129](https://github.com/oupala/apaxy/commit/8ca6129))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [2.1.0](https://github.com/oupala/apaxy/compare/2.0.1...2.1.0) (2019-05-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* install script can set a header and a footer message ([8f85f2c](https://github.com/oupala/apaxy/commit/8f85f2c))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.0.1](https://github.com/oupala/apaxy/compare/2.0.0...2.0.1) (2019-05-30)
|
## [2.0.1](https://github.com/oupala/apaxy/compare/2.0.0...2.0.1) (2019-05-30)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -16,13 +16,17 @@ set -eo pipefail
|
|||||||
IFS=$'\n\t'
|
IFS=$'\n\t'
|
||||||
|
|
||||||
# default config
|
# default config
|
||||||
defaultLogLevel=2
|
defaultConfigFile="apaxy.config"
|
||||||
defaultLogFile="$(basename "${0}" .sh).log"
|
|
||||||
defaultApacheWebRootPath="/var/www/html"
|
defaultApacheWebRootPath="/var/www/html"
|
||||||
defaultInstallWebPath=""
|
defaultInstallWebPath=""
|
||||||
defaultEnableGallery=false
|
defaultEnableGallery=false
|
||||||
|
defaultHeaderMessage=""
|
||||||
|
defaultFooterMessage=""
|
||||||
|
defaultLogLevel=2
|
||||||
|
defaultLogFile="$(basename "${0}" .sh).log"
|
||||||
|
|
||||||
workingDirectory="$(dirname "${0}")"
|
workingDirectory="$(dirname "${0}")"
|
||||||
|
logLevel="${defaultLogLevel}"
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
|
|
||||||
@@ -41,9 +45,12 @@ EOF
|
|||||||
|
|
||||||
Available optionnal parameters are :
|
Available optionnal parameters are :
|
||||||
-h - display help
|
-h - display help
|
||||||
|
-c - set path/to/apaxy.config file that contains all configuration
|
||||||
-d - set path/to/dir/ directory where apaxy will be installed on the filesystem
|
-d - set path/to/dir/ directory where apaxy will be installed on the filesystem
|
||||||
-w - set path/to/dir/ directory where apaxy will be available on the httpd server
|
-w - set path/to/dir/ directory where apaxy will be available on the httpd server
|
||||||
-g - enable or disable gallery feature
|
-g - enable or disable gallery feature
|
||||||
|
-hm - set the default header message displayed on top of each page
|
||||||
|
-fm - set the default footer message displayed on bottom of each page
|
||||||
-ll - set the log level
|
-ll - set the log level
|
||||||
-lf - set the log file
|
-lf - set the log file
|
||||||
EOF
|
EOF
|
||||||
@@ -54,7 +61,7 @@ EOF
|
|||||||
##
|
##
|
||||||
displayUsage () {
|
displayUsage () {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
usage - $(basename "${0}") [-h] [-d path/to/dir/] [-w path/to/dir/] [-g true|false] [-ll logLevel] [-lf logFile]
|
usage - $(basename "${0}") [-h] [-c path/to/apaxy.config] [-d path/to/dir/] [-w path/to/dir/] [-g true|false] [-hm "header message"] [-fm "footer message"] [-ll logLevel] [-lf logFile]
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,15 +92,6 @@ log () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# getting parameters value from config file (can be overloaded by cli values)
|
|
||||||
if [ -f "${workingDirectory}/apaxy.config" ]; then
|
|
||||||
# shellcheck source=apaxy.config
|
|
||||||
source "${workingDirectory}/apaxy.config"
|
|
||||||
else
|
|
||||||
log 1 "ERROR - apaxy configuration not found, please restore or create the configuration file apaxy.config"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# getting parameters value from cli (can overload config file values)
|
# getting parameters value from cli (can overload config file values)
|
||||||
while [ "$#" -ge 1 ] ; do
|
while [ "$#" -ge 1 ] ; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
@@ -101,25 +99,37 @@ while [ "$#" -ge 1 ] ; do
|
|||||||
displayHelp
|
displayHelp
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
-c) # set path/to/apaxy.config file that contains all configuration
|
||||||
|
shiftStep=2
|
||||||
|
paramConfigFile="${2}"
|
||||||
|
;;
|
||||||
-d) # set path/to/dir/ directory where apaxy will be available on the httpd server
|
-d) # set path/to/dir/ directory where apaxy will be available on the httpd server
|
||||||
shiftStep=2
|
shiftStep=2
|
||||||
apacheWebRootPath="${2}"
|
paramApacheWebRootPath="${2}"
|
||||||
;;
|
;;
|
||||||
-w) # set path/to/dir/ directory where apaxy will be installed on the filesystem
|
-w) # set path/to/dir/ directory where apaxy will be installed on the filesystem
|
||||||
shiftStep=2
|
shiftStep=2
|
||||||
installWebPath="${2}"
|
paramInstallWebPath="${2}"
|
||||||
;;
|
;;
|
||||||
-g) # enable or disable gallery feature
|
-g) # enable or disable gallery feature
|
||||||
shiftStep=2
|
shiftStep=2
|
||||||
enableGallery="${2}"
|
paramEnableGallery="${2}"
|
||||||
|
;;
|
||||||
|
-hm) # set the default header message displayed on top of each page
|
||||||
|
shiftStep=2
|
||||||
|
paramHeaderMessage="${2}"
|
||||||
|
;;
|
||||||
|
-fm) # set the default footer message displayed on bottom of each page
|
||||||
|
shiftStep=2
|
||||||
|
paramFooterMessage="${2}"
|
||||||
;;
|
;;
|
||||||
-ll) # set the log level
|
-ll) # set the log level
|
||||||
shiftStep=2
|
shiftStep=2
|
||||||
logLevel="${2}"
|
paramLogLevel="${2}"
|
||||||
;;
|
;;
|
||||||
-lf) # set the log file
|
-lf) # set the log file
|
||||||
shiftStep=2
|
shiftStep=2
|
||||||
logFile="${2}"
|
paramLogFile="${2}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
displayUsage
|
displayUsage
|
||||||
@@ -137,34 +147,93 @@ while [ "$#" -ge 1 ] ; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# setting parameters value
|
# setting parameters value
|
||||||
if [ -z "${apacheWebRootPath}" ]
|
if [ -r "${paramConfigFile}" ]
|
||||||
|
then
|
||||||
|
# getting parameters value from config file (config file name set by cli values)
|
||||||
|
configFile="${paramConfigFile}"
|
||||||
|
# shellcheck source=apaxy.config
|
||||||
|
source "${configFile}"
|
||||||
|
elif [ -r "${workingDirectory}/${defaultConfigFile}" ]
|
||||||
|
then
|
||||||
|
# getting parameters value from config file (config file name is default)
|
||||||
|
configFile="${workingDirectory}/${defaultConfigFile}"
|
||||||
|
# shellcheck source=apaxy.config
|
||||||
|
source "${configFile}"
|
||||||
|
else
|
||||||
|
log 1 "apaxy configuration not found, using internal config from script shell itself"
|
||||||
|
configFile=null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${paramApacheWebRootPath}" ]
|
||||||
|
then
|
||||||
|
apacheWebRootPath="${paramApacheWebRootPath}"
|
||||||
|
elif [ -z "${apacheWebRootPath}" ]
|
||||||
then
|
then
|
||||||
apacheWebRootPath="${defaultApacheWebRootPath}"
|
apacheWebRootPath="${defaultApacheWebRootPath}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${installWebPath}" ]
|
if [ -n "${paramInstallWebPath}" ]
|
||||||
|
then
|
||||||
|
installWebPath="${paramInstallWebPath}"
|
||||||
|
elif [ -z "${installWebPath}" ]
|
||||||
then
|
then
|
||||||
installWebPath="${defaultInstallWebPath}"
|
installWebPath="${defaultInstallWebPath}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${apacheWebRootPath}" ] && [ -z "${installWebPath}" ]
|
if [ -n "${paramApacheWebRootPath}" ]
|
||||||
then
|
then
|
||||||
installDir="${apacheWebRootPath}"
|
apacheWebRootPath="${paramApacheWebRootPath}"
|
||||||
else
|
elif [ -z "${apacheWebRootPath}" ]
|
||||||
installDir="${apacheWebRootPath}${installWebPath}"
|
then
|
||||||
|
apacheWebRootPath="${defaultApacheWebRootPath}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${enableGallery}" ]
|
if [ -n "${paramInstallWebPath}" ]
|
||||||
|
then
|
||||||
|
installWebPath="${paramInstallWebPath}"
|
||||||
|
elif [ -z "${installWebPath}" ]
|
||||||
|
then
|
||||||
|
installWebPath="${defaultInstallWebPath}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
installDir="${apacheWebRootPath}${installWebPath}"
|
||||||
|
|
||||||
|
if [ -n "${paramEnableGallery}" ]
|
||||||
|
then
|
||||||
|
enableGallery="${paramEnableGallery}"
|
||||||
|
elif [ -z "${enableGallery}" ]
|
||||||
then
|
then
|
||||||
enableGallery="${defaultEnableGallery}"
|
enableGallery="${defaultEnableGallery}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${logLevel}" ]
|
if [ -n "${paramHeaderMessage}" ]
|
||||||
|
then
|
||||||
|
headerMessage="${paramHeaderMessage}"
|
||||||
|
elif [ -z "${headerMessage}" ]
|
||||||
|
then
|
||||||
|
headerMessage="${defaultHeaderMessage}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${paramFooterMessage}" ]
|
||||||
|
then
|
||||||
|
footerMessage="${paramFooterMessage}"
|
||||||
|
elif [ -z "${footerMessage}" ]
|
||||||
|
then
|
||||||
|
footerMessage="${defaultFooterMessage}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${paramLogLevel}" ]
|
||||||
|
then
|
||||||
|
logLevel="${paramLogLevel}"
|
||||||
|
elif [ -z "${logLevel}" ]
|
||||||
then
|
then
|
||||||
logLevel="${defaultLogLevel}"
|
logLevel="${defaultLogLevel}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${logFile}" ]
|
if [ -n "${paramLogFile}" ]
|
||||||
|
then
|
||||||
|
logFile="${paramLogFile}"
|
||||||
|
elif [ -z "${logFile}" ]
|
||||||
then
|
then
|
||||||
logFile="${workingDirectory}/${defaultLogFile}"
|
logFile="${workingDirectory}/${defaultLogFile}"
|
||||||
fi
|
fi
|
||||||
@@ -181,6 +250,19 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# script
|
# script
|
||||||
|
|
||||||
|
# output current config
|
||||||
|
log 3 "current config"
|
||||||
|
log 3 " configFile: ${configFile}"
|
||||||
|
log 3 " apacheWebRootPath: ${apacheWebRootPath}"
|
||||||
|
log 3 " installWebPath: ${installWebPath}"
|
||||||
|
log 3 " installDir: ${installDir}"
|
||||||
|
log 3 " enableGallery: ${enableGallery}"
|
||||||
|
log 3 " headerMessage: ${headerMessage}"
|
||||||
|
log 3 " footerMessage: ${footerMessage}"
|
||||||
|
log 3 " logLevel: ${logLevel}"
|
||||||
|
log 3 " logFile: ${logFile}"
|
||||||
|
|
||||||
log 1 "- creating install directory ${installDir}"
|
log 1 "- creating install directory ${installDir}"
|
||||||
mkdir -p "${installDir}"
|
mkdir -p "${installDir}"
|
||||||
if [ ! -d "${installDir}" ] || [ ! -w "${installDir}" ]; then
|
if [ ! -d "${installDir}" ] || [ ! -w "${installDir}" ]; then
|
||||||
@@ -189,6 +271,8 @@ if [ ! -d "${installDir}" ] || [ ! -w "${installDir}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log 1 "- copying apaxy in install directory"
|
log 1 "- copying apaxy in install directory"
|
||||||
|
# we want globbing
|
||||||
|
# shellcheck disable=SC2086
|
||||||
cp -r ${workingDirectory}/apaxy/* "${installDir}/"
|
cp -r ${workingDirectory}/apaxy/* "${installDir}/"
|
||||||
|
|
||||||
log 1 "- configuring apaxy in install directory"
|
log 1 "- configuring apaxy in install directory"
|
||||||
@@ -212,6 +296,8 @@ log 2 "- setting path in html files"
|
|||||||
files=$(find ${installDir} -name "*.html")
|
files=$(find ${installDir} -name "*.html")
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
sed -i "s|{FOLDERNAME}|${installWebPath}|g" "${file}"
|
sed -i "s|{FOLDERNAME}|${installWebPath}|g" "${file}"
|
||||||
|
sed -i "s|{HEADER-MESSAGE}|${headerMessage}|g" "${file}"
|
||||||
|
sed -i "s|{FOOTER-MESSAGE}|${footerMessage}|g" "${file}"
|
||||||
done <<< "${files}"
|
done <<< "${files}"
|
||||||
|
|
||||||
log 2 "- syncing filesystem"
|
log 2 "- syncing filesystem"
|
||||||
|
@@ -50,3 +50,9 @@ installWebPath=""
|
|||||||
# please enable it with caution
|
# please enable it with caution
|
||||||
#
|
#
|
||||||
enableGallery=false
|
enableGallery=false
|
||||||
|
|
||||||
|
# set the default header message displayed on top of each page
|
||||||
|
defaultHeaderMessage=""
|
||||||
|
|
||||||
|
# set the default footer message displayed on bottom of each page
|
||||||
|
defaultFooterMessage=""
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<div class="block">
|
<div class="block">
|
||||||
You can add your own HTML above or below the directory listing. Simply explore the <code>header.html</code> and <code>footer.html</code> files.
|
{FOOTER-MESSAGE}
|
||||||
</div><!--/.postlisting-->
|
</div><!--/.postlisting-->
|
||||||
|
|
||||||
</div><!--/.wrapper-->
|
</div><!--/.wrapper-->
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<div class="block">
|
<div class="block">
|
||||||
You can add your own HTML above or below the directory listing. Simply explore the <code>header.html</code> and <code>footer.html</code> files.
|
{FOOTER-MESSAGE}
|
||||||
</div><!--/.postlisting-->
|
</div><!--/.postlisting-->
|
||||||
|
|
||||||
</div><!--/.wrapper-->
|
</div><!--/.wrapper-->
|
||||||
|
@@ -7,3 +7,5 @@
|
|||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<input type="search" id="filter" placeholder="filter contents" />
|
<input type="search" id="filter" placeholder="filter contents" />
|
||||||
|
|
||||||
|
{HEADER-MESSAGE}
|
||||||
|
@@ -5,3 +5,5 @@
|
|||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<input type="search" id="filter" placeholder="filter contents" />
|
<input type="search" id="filter" placeholder="filter contents" />
|
||||||
|
|
||||||
|
{HEADER-MESSAGE}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "apaxy",
|
"name": "apaxy",
|
||||||
"version": "2.0.1",
|
"version": "2.1.1",
|
||||||
"description": "A simple, customisable theme for your Apache directory listing.",
|
"description": "A simple, customisable theme for your Apache directory listing.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user