install_postfixadmin.sh: support now git repositoty.

This commit is contained in:
Christoph 2020-08-15 18:48:17 +02:00
parent a87f841172
commit b3e271e848

View File

@ -720,12 +720,33 @@ echo -e "\n\n\t\033[37m\033[1mBase install Postfixadmin..\033[m\n"
# -
echononl "\tDownload 'postfixadmin-${PF_ADMIN_VERSION}'.."
if [[ ! -f "${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz" ]];then
wget -O ${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-${PF_ADMIN_VERSION}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz > $log_file 2>&1
# Download location has changed!
#
#wget -O ${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-${PF_ADMIN_VERSION}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz > $log_file 2>&1
# Download from github.com..
#
wget -O ${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}.tar.gz https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${PF_ADMIN_VERSION}.tar.gz > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
error "$(cat $log_file)"
echononl "\tcontinue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Script terminated by user input.."
fi
else
echo_skipped
@ -782,6 +803,29 @@ else
fi
if [[ ! -d "${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}" ]] ; then
if [[ -d "${_src_base_dir}/postfixadmin-postfixadmin-${PF_ADMIN_VERSION}" ]] ; then
echononl "\tRename source directory 'postfixadmin-postfixadmin-${PF_ADMIN_VERSION}' to 'postfixadmin-${PF_ADMIN_VERSION}'"
mv "${_src_base_dir}/postfixadmin-postfixadmin-${PF_ADMIN_VERSION}" \
"${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION}" > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "\tcontinue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Script terminated by user input.."
fi
fi
fi
echononl "\tCopy Postfix Admin Directory to web-directory"
cp -a ${_src_base_dir}/postfixadmin-${PF_ADMIN_VERSION} ${WEBSITE_BASEDIR}/
@ -790,6 +834,15 @@ if [[ $? -eq 0 ]]; then
else
echo_failed
error "$(cat $log_file)"
echononl "\tcontinue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Script terminated by user input.."
fi
_failed=false
@ -3109,6 +3162,19 @@ else
echo_skipped
fi
if ! $(grep -q -E "^\s*\$version\s*=\s*'${PF_ADMIN_VERSION}'" \
"${WEBSITE_BASEDIR}/postfixadmin-${PF_ADMIN_VERSION}/functions.inc.php" 2> /dev/null) ; then
echononl "\tSet correct version number in file 'functions.inc.php'.."
perl -i.ORIG -n -p -e "s#^\s*\\\$version\s+=.*#\\\$version = '${PF_ADMIN_VERSION}';#" \
/var/www/adm-e.oopen.de/postfixadmin-${PF_ADMIN_VERSION}/functions.inc.php > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat "$log_file")"
fi
fi
echo -e "\n\n\t\033[37m\033[1mSome final checks\033[m\n"