diff --git a/bin/lemper-cli b/bin/lemper-cli new file mode 100755 index 0000000..10027c5 Binary files /dev/null and b/bin/lemper-cli differ diff --git a/bin/lemper-cli.sh b/bin/lemper-cli.sh deleted file mode 100755 index c05c93b..0000000 --- a/bin/lemper-cli.sh +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/bash - -# +-------------------------------------------------------------------------+ -# | Lemper CLI - Simple LEMP Stack Manager | -# +-------------------------------------------------------------------------+ -# | Copyright (c) 2014-2019 ESLabs (https://eslabs.id/ngxtool) | -# +-------------------------------------------------------------------------+ -# | This source file is subject to the GNU General Public License | -# | that is bundled with this package in the file LICENSE.md. | -# | | -# | If you did not receive a copy of the license and are unable to | -# | obtain it through the world-wide-web, please send an email | -# | to license@eslabs.id so we can send you a copy immediately. | -# +-------------------------------------------------------------------------+ -# | Authors: Edi Septriyanto | -# +-------------------------------------------------------------------------+ - -set -e - -# Version control. -APP_NAME=$(basename "$0") -APP_VERSION="1.3.0" - -# Export LEMPer stack configuration. -if [ -f "/etc/lemper/lemper.conf" ]; then - # Clean environemnt first. - # shellcheck source=/etc/lemper/lemper.conf - # shellcheck disable=SC2046 - unset $(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's/(.*)=.*/\1/' | xargs) - - # shellcheck source=/etc/lemper/lemper.conf - # shellcheck disable=SC1094 - # shellcheck disable=SC1091 - source <(grep -v '^#' /etc/lemper/lemper.conf | grep -v '^\[' | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g') -else - echo "LEMPer stack configuration required, but the file doesn't exist." - echo "It should be created during installation process and placed under '/etc/lemper/lemper.conf'" - exit 1 -fi - -# Set default variables. -LEMPER_USERNAME=${LEMPER_USERNAME:-"lemper"} -LEMPER_PASSWORD=${LEMPER_PASSWORD:-""} -MYSQL_ROOT_PASS=${MYSQL_ROOT_PASS:-""} - -# App library directory. -APP_LIB_DIR="/usr/local/lib/lemper" - - -## -# Show usage -# output to STDERR. -# -function cmd_help() { - cat <<- _EOF_ -${APP_NAME^} ${APP_VERSION} -Command line management tool for LEMPer stack. - -Usage: $APP_NAME [--version] [--help] - [] - -These are common $APP_NAME commands used in various situations: - create Create new virtual host - manage Enable, disable, delete existing virtual host - -For help with each command run: -$APP_NAME -h|--help -_EOF_ - - exit 0 -} - -## -# Show version. -# -function cmd_version() { - echo "$APP_NAME version $APP_VERSION" - exit 0 -} - -## -# Create new webapp. -# -function cmd_create() { - if [ -x "$APP_LIB_DIR/lemper-create" ]; then - "$APP_LIB_DIR/lemper-create" "$@" - else - echo "Oops, lemper create subcommand module couldn't be loaded." - exit 1 - fi -} - -# Aliases to create. -function cmd_vhost() { - cmd_create "$@" -} - -# Aliases to create. -function cmd_site() { - cmd_create "$@" -} - -## -# Manage existing webapp. -# -function cmd_manage() { - if [ -x "$APP_LIB_DIR/lemper-manage" ]; then - "$APP_LIB_DIR/lemper-manage" "$@" - else - echo "Oops, lemper manage subcommand module couldn't be loaded." - exit 1 - fi -} - -## -# Manage database. -# -function cmd_db() { - if [ -x "$APP_LIB_DIR/lemper-db" ]; then - "$APP_LIB_DIR/lemper-db" "$@" - else - echo "Oops, lemper db (database) subcommand module couldn't be loaded." - exit 1 - fi -} - -## -# TinyFileManager add user. -# -function cmd_tfm() { - if [ -x "$APP_LIB_DIR/lemper-tfm" ]; then - "$APP_LIB_DIR/lemper-tfm" "$@" - else - echo "Oops, lemper tfm subcommand module couldn't be loaded." - exit 1 - fi -} - - -## -# Main App -# -SUBCOMMAND="${1}" -case ${SUBCOMMAND} in - "" | "help" ) - cmd_help - ;; - - "version") - cmd_version - ;; - - *) - shift - if declare -F "cmd_${SUBCOMMAND}" &>/dev/null; then - "cmd_${SUBCOMMAND}" "$@" - else - echo "Error: '${SUBCOMMAND}' is not a known command." >&2 - echo "Run '${APP_NAME} --help' for a list of known commands." >&2 - exit 1 - fi - ;; -esac diff --git a/scripts/install_tools.sh b/scripts/install_tools.sh index 81b0f98..021c51b 100755 --- a/scripts/install_tools.sh +++ b/scripts/install_tools.sh @@ -23,7 +23,8 @@ requires_root function init_webadmin_install() { # Install Lemper CLI tool. echo "Installing Lemper CLI tool..." - run cp -f bin/lemper-cli.sh /usr/local/bin/lemper-cli + #run cp -f bin/lemper-cli.sh /usr/local/bin/lemper-cli + run cp -f bin/lemper-cli /usr/local/bin/ && \ run chmod ugo+x /usr/local/bin/lemper-cli if [ ! -d /usr/local/lib/lemper ]; then