Skip to content

Commit

Permalink
Merge pull request #140 from joglomedia/2.x.x
Browse files Browse the repository at this point in the history
Fix issue #139 FTP install error
  • Loading branch information
joglomedia authored Jul 29, 2022
2 parents 9cc3e04 + 8bbe96e commit 4871639
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
19 changes: 7 additions & 12 deletions scripts/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,6 @@ function get_release_name() {
DISTRIB_RELEASE="LM${MAJOR_RELEASE_VERSION}"

case "${DISTRIB_RELEASE}" in
"16.04"|"LM18")
# Ubuntu release 16.04, LinuxMint 18 <= EOL
#RELEASE_NAME=${UBUNTU_CODENAME:-"xenial"}
RELEASE_NAME="unsupported"
;;
"18.04"|"LM19")
# Ubuntu release 18.04, LinuxMint 19
RELEASE_NAME=${UBUNTU_CODENAME:-"bionic"}
Expand All @@ -412,9 +407,9 @@ function get_release_name() {
# Ubuntu release 20.04, LinuxMint 20
RELEASE_NAME=${UBUNTU_CODENAME:-"focal"}
;;
"21.04")
# Ubuntu release 21.04
RELEASE_NAME=${UBUNTU_CODENAME:-"hirsuite"}
"22.04"|"LM21")
# Ubuntu release 22.04, LinuxMint 21
RELEASE_NAME=${UBUNTU_CODENAME:-"jammy"}
;;
*)
RELEASE_NAME="unsupported"
Expand Down Expand Up @@ -453,15 +448,15 @@ function get_ip_private() {
SERVER_IP_PRIVATE=$(ip addr | grep 'inet' | grep -v inet6 | \
grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | \
grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)

echo "${SERVER_IP_PRIVATE}"
}

# Get server public IP Address.
function get_ip_public() {
local SERVER_IP_PRIVATE && SERVER_IP_PRIVATE=$(get_ip_private)
local SERVER_IP_PUBLIC && \
SERVER_IP_PUBLIC=$(curl -s http://ipecho.net/plain)
SERVER_IP_PUBLIC=$(curl -sk --connect-timeout 10 --retry 3 --retry-delay 0 http://ipecho.net/plain)

# Ugly hack to detect aws-lightsail public IP address.
if [[ "${SERVER_IP_PRIVATE}" == "${SERVER_IP_PUBLIC}" ]]; then
Expand Down Expand Up @@ -508,9 +503,9 @@ function preflight_system_check() {

if grep -q "${SERVER_HOSTNAME}" /etc/hosts; then
run sed -i".bak" "/${SERVER_HOSTNAME}/d" /etc/hosts
run bash -c "echo -e '${SERVER_IP_LOCAL}\t${SERVER_HOSTNAME}' >> /etc/hosts"
run bash -c "echo -e '${SERVER_IP}\t${SERVER_HOSTNAME}' >> /etc/hosts"
else
run bash -c "echo -e '\n# LEMPer local hosts\n${SERVER_IP_LOCAL}\t${SERVER_HOSTNAME}' >> /etc/hosts"
run bash -c "echo -e '\n# LEMPer local hosts\n${SERVER_IP}\t${SERVER_HOSTNAME}' >> /etc/hosts"
fi

export HOSTNAME && \
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_vsftpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function init_vsftpd_install() {
run cd "${BUILD_DIR}" && \
run wget -q "${VSFTPD_ZIP_URL}" && \
run tar -zxf "${VSFTPD_FILENAME}" && \
run cd "${VSFTPD_FILENAME%.*.*}" / || return 1
run cd "${VSFTPD_FILENAME%.*.*}" || return 1

# If SSL Enabled, modify the builddefs.h file.
if [[ "${FTP_SSL_ENABLE}" == true ]]; then
Expand Down
19 changes: 19 additions & 0 deletions shunit2/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,25 @@ testTrueInstallCertbot()
assertTrue "[[ ${cb} -gt 0 ]]"
}

testTrueInstallFTPServer()
{
if [[ "${FTP_SERVER_NAME}" == "pureftpd" || "${FTP_SERVER_NAME}" == "pure-ftpd" ]]; then
if [ -f scripts/install_pureftpd.sh ]; then
. scripts/install_pureftpd.sh
fi

ftps=$(command -v pure-ftpd | grep -c pure-ftpd)
assertTrue "[[ ${ftps} -gt 0 ]]"
else
if [ -f scripts/install_vsftpd.sh ]; then
. scripts/install_vsftpd.sh
fi

ftps=$(command -v vsftpd | grep -c vsftpd)
assertTrue "[[ ${ftps} -gt 0 ]]"
fi
}

testTrueInstallNginx()
{
. scripts/install_nginx.sh
Expand Down

0 comments on commit 4871639

Please sign in to comment.