From 88619a8dd650609b009868b8c89138cc3877f6d9 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Sun, 20 Aug 2017 22:58:45 -0500 Subject: [PATCH 1/5] Began implementation of installer update. Created an installer utility library. The installer will be responsible for checking dependencies & updates. --- lib/ColorUtils.sh | 16 +++ lib/installer/InstallerUtils.sh | 208 ++++++++++++++++++++++++++++++ lib/installer/managers/apt-get.sh | 30 +++++ lib/installer/managers/emerge.sh | 19 +++ lib/installer/managers/pacman.sh | 19 +++ lib/installer/managers/yum.sh | 19 +++ lib/installer/managers/zypp.sh | 19 +++ 7 files changed, 330 insertions(+) create mode 100755 lib/ColorUtils.sh create mode 100644 lib/installer/InstallerUtils.sh create mode 100644 lib/installer/managers/apt-get.sh create mode 100644 lib/installer/managers/emerge.sh create mode 100644 lib/installer/managers/pacman.sh create mode 100644 lib/installer/managers/yum.sh create mode 100644 lib/installer/managers/zypp.sh diff --git a/lib/ColorUtils.sh b/lib/ColorUtils.sh new file mode 100755 index 0000000..c87df81 --- /dev/null +++ b/lib/ColorUtils.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +SandboxUtilsVersion="1.0" + +################################# < Shell Color Codes > ################################ +readonly CRed="\e[1;31m" +readonly CGrn="\e[1;32m" +readonly CYel="\e[1;33m" +readonly CBlu="\e[1;34m" +readonly CPrp="\e[5;35m" +readonly CCyn="\e[5;36m" +readonly CGry="\e[0;37m" +readonly CWht="\e[1;37m" +readonly CClr="\e[0m" + +# FLUXSCRIPT END diff --git a/lib/installer/InstallerUtils.sh b/lib/installer/InstallerUtils.sh new file mode 100644 index 0000000..7764b54 --- /dev/null +++ b/lib/installer/InstallerUtils.sh @@ -0,0 +1,208 @@ +#!/bin/bash + +if [ "$InstallerUtilsVersion" ]; then return 0; fi +readonly InstallerUtilsVersion="1.0" + +InstallerUtilsWorkspacePath="/tmp/verspace" + +InstallerUtilsOutputDevice="/dev/stdout" + +InstallerUtilsNoticeMark="*" + +function installer_utils_run_spinner() { + local pid=$1 + local delay=0.15 + local spinstr='|/-\' + + tput civis + while [ "`ps a | awk '{print $1}' | grep $pid`" ]; do + local temp=${spinstr#?} + printf " [%c] " "$spinstr" + local spinstr=$temp${spinstr%"$temp"} + sleep $delay + printf "\b\b\b\b\b\b" + done + + printf " \b\b\b\b" + tput cnorm +} + +# Pamaters: $1 - url $2 - regex +function installer_utils_check_version() { + if [ ! "$1" ]; then return 1; fi + + # Attempt to retrieve versioning information from repository script. + local __installer_utils_check_version__online=("`timeout -s SIGTERM 20 curl "$1" 2>/dev/null | egrep "$2"`") + + if [ "${__installer_utils_check_version__online[@]}" ] + then echo -e "${__installer_utils_check_version__online[@]}" > "$InstallerUtilsWorkspacePath/latest_version" + fi +} + +# Pamaters: $1 - update url $2 - update regex $3 - local version $4 - local revision +function installer_utils_check_update() { + local versionDialog="Online Version" + local versionDialogOffset=$(($(tput cols) / 2 + ((${#versionDialog} / 2) - 4))) + printf "%${versionDialogOffset}s" "$versionDialog" + + installer_utils_check_version "${@:1:2}" & + installer_utils_run_spinner "$!" + + local __installer_utils_check_update__localVersion=$3 + local __installer_utils_check_update__localRevision=$4 + local __installer_utils_check_update__version="?" + local __installer_utils_check_update__revision="?" + + if [ -f "$InstallerUtilsWorkspacePath/latest_version" -a \ + -s "$InstallerUtilsWorkspacePath/latest_version" ]; then + mapfile __installer_utils_check_update__vInfo < "$InstallerUtilsWorkspacePath/latest_version" + __installer_utils_check_update__version=$(echo "${__installer_utils_check_update__vInfo[@]}" | awk -F= 'tolower($1)~/version/{print $2}') + __installer_utils_check_update__revision=$(echo "${__installer_utils_check_update__vInfo[@]}" | awk -F= 'tolower($1)~/revision/{print $2}') + fi + + echo -e "$CClr [$__installer_utils_check_update__version.$__installer_utils_check_update__revision$CClr]" + + echo + + if [ "$__installer_utils_check_update__version" != "?" -a "$__installer_utils_check_update__revision" != "?" ]; then + if [ "$__installer_utils_check_update__version" -gt "$__installer_utils_check_update__localVersion" -o \ + "$__installer_utils_check_update__version" -eq "$__installer_utils_check_update__localRevision" -a \ + "$__installer_utils_check_update__revision" -gt "$__installer_utils_check_update__localRevision" ]; then + format_center_literals "${CRed}A newer version has been found!$CClr" + return 0 + fi + fi + + return 1 # Failure +} + +# Parameters: $1 - Update source (zip) $2 - Backup file name $3 - Update output +function installer_utils_run_update() { + if [ ${#@} -ne 2 ]; then return 1; fi + + local __installer_utils_run_update__source="$1" + local __installer_utils_run_update__backup="$2" + local __installer_utils_run_update__output="$3" + + format_center_literals "${CYel}[ Press Y or enter to update, anything else to skip ]$CClr" + + tput civis + local __installer_utils_run_update__option + read -N1 __installer_utils_run_update__option + tput cnorm + + __installer_utils_run_update__option=${__installer_utils_run_update__option:-Y} + + # If the user doesn't want to upgrade, stop this procedure. + if [ "$__installer_utils_run_update__option" != "Y" -a \ + "$__installer_utils_run_update__option" != "y" ] + then return 1 + fi + + local __installer_utils_run_update__backupFile="$__installer_utils_run_update__backup-`date +%F_%T`" + local __installer_utils_run_update__backupPath="`dirname $__installer_utils_run_update__output`/$__installer_utils_run_update__backupFile.7z" + + # If a file with the backup name already exists, abort. + if [ -f "$__installer_utils_run_update__backupPath" ] + then return 2 + fi + + format_center_literals "${CClr}[ ~ Creating Backup ~ ]$CClr"; echo + # This could use a progress indicator, but I'm a bit tired. + 7zr a "$__installer_utils_run_update__backupPath" "$__installer_utils_run_update__output" &> $InstallerUtilsOutputDevice + + + format_center_literals "${CClr}[ ~ Downloading Update ~ ]$CClr"; echo + if ! curl -L "$__installer_utils_run_update__source" -o "$InstallerUtilsWorkspacePath/update.zip"; then + format_center_literals "${CRed}[ ~ Download Failed ~ ]$CClr" + sleep 3 + return 3 + fi + + format_center_literals "${CClr}[ ~ Verifying Download ~ ]$CClr"; echo + if ! unzip -t "$InstallerUtilsWorkspacePath/update.zip"; then + format_center_literals "${CRed}[ ~ Download Appears Corrupted ~ ]$CClr" + sleep 3 + return 4 + fi + + format_center_literals "${CClr}[ ~ Extracting Files ~ ]$CClr"; echo + mkdir "$InstallerUtilsWorkspacePath/update_contents" + unzip "$InstallerUtilsWorkspacePath/update.zip" -d "$InstallerUtilsWorkspacePath/update_contents" + + + if [ ! -d "$__installer_utils_run_update__output" ]; then + if ! mkdir -p "$__installer_utils_run_update__output"; then + format_center_literals "${CRed}[ ~ Failed To Create Destination Directory ~ ]$CClr"; echo + fi + fi + + format_center_literals "${CClr}[ ~ Moving Files ~ ]$CClr"; echo + mv "$InstallerUtilsWorkspacePath"/update_contents/* "$__installer_utils_run_update__output" + + format_center_literals "${CGrn}[ ~ Update Completed ~ ]$CClr"; echo + sleep 3 +} + +# Parameters: $1 - CLI Tools required array $2 - CLI Tools missing array (will be populated) +function installer_utils_check_dependencies() { + if [ ${#@} -ne 2 ]; then return 1; fi + + local __installer_utils_run_dependencies__CLITools=("${!1}") + local __installer_utils_run_dependencies__CLIToolsMissing=("${!2}") + + local __installer_utils_run_dependencies__CLITool + for __installer_utils_run_dependencies__CLITool in "${__installer_utils_run_dependencies__CLITools[@]}"; do + local __installer_utils_run_dependencies__identifier="`printf "%-44s" "$__installer_utils_run_dependencies__CLITool"`" + local __installer_utils_run_dependencies__state=".....$CGrn OK.$CClr" + + if ! hash "$__installer_utils_run_dependencies__CLITool" 2>/dev/null; then + __installer_utils_run_dependencies__state="$CRed Missing!$CClr" + __installer_utils_run_dependencies__CLIToolsMissing+=("$__installer_utils_run_dependencies__CLITool") + fi + + format_center_literals "$InstallerUtilsNoticeMark ${__installer_utils_run_dependencies__identifier// /.}$__installer_utils_run_dependencies__state" + echo -e "$FormatCenterLiterals" + done + + if [ ${#__installer_utils_run_dependencies__CLIToolsMissing[@]} -gt 0 ]; then return 2; fi +} + +# Parameters: $1 - CLI Tools missing array (will be installed) $2 - substitutes array +function installer_utils_run_dependencies() { + if [ "${#@}" -ne 2 ]; then return 1; fi + + # The array below holds all the packages that will be installed. + local __installer_utils_run_dependencies__packages=("${!1}") + # The array below holds packages and their substitution. + local __installer_utils_run_dependencies__substitutes=("${!2}") + + local __installer_utils_run_dependencies__managers=(lib/installer/managers/*) + + local __installer_utils_run_dependencies__manager + for __installer_utils_run_dependencies__manager in "${__installer_utils_run_dependencies__managers[@]}"; do + source "$__installer_utils_run_dependencies__manager" + if [ "$PackageManagerCLT" ]; then break; fi + done + + if [ ! "$PackageManagerCLT" ]; then + format_center_literals "${CRed}[ ~ No Suitable Package Manager Found ~ ]$CClr"; echo + sleep 3 + return 2 + fi + + prep_package_manager + + for __installer_utils_run_dependencies__package in "${__installer_utils_run_dependencies__packages[@]}"; do + clear + local __installer_utils_run_dependencies__target=$__installer_utils_run_dependencies__package + if [ "${__installer_utils_run_dependencies__substitutes[$__installer_utils_run_dependencies__package]}" + then __installer_utils_run_dependencies__target=${__installer_utils_run_dependencies__substitutes[$__installer_utils_run_dependencies__package]} + fi + $PackageManagerCLT $PackageManagerCLTInstallOptions $__installer_utils_run_dependencies__target + done + + unprep_package_manager +} + +# FLUXSCRIPT END diff --git a/lib/installer/managers/apt-get.sh b/lib/installer/managers/apt-get.sh new file mode 100644 index 0000000..2c5ebda --- /dev/null +++ b/lib/installer/managers/apt-get.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [ -f "/etc/debian_version" ] + PackageManagerCLT="apt-get" + PackageManagerCLTInstallOptions="install -y" + PackageManagerCLTRemoveOptions="remove -y" + + PackageManagerOutputDevice="/dev/stdout" + + function unprep_package_manager() { + echo "$(cat /etc/apt/sources.list | grep -v 'deb http://http.kali.org/kali kali-rolling main contrib non-free # Installed By FLUXION')" > /etc/apt/sources.list + } + + function prep_package_manager() { + if [ ! "`(cat /etc/apt/sources.list | grep 'deb http://http.kali.org/kali kali-rolling main contrib non-free'`" ]; then + gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6 + apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6 + echo "deb http://http.kali.org/kali kali-rolling main contrib non-free # Installed By FLUXION" >> /etc/apt/sources.list + fi + + # Cleanup package manager + sudo apt-get install -f -y | tee -a $PackageManagerOutputDevice + sudo apt-get autoremove -y | tee -a $PackageManagerOutputDevice + sudo apt-get autoclean -y | tee -a $PackageManagerOutputDevice + sudo apt-get clean -y | tee -a $PackageManagerOutputDevice + sudo apt-get update | tee -a $PackageManagerOutputDevice + } +fi + +# FLUXSCRIPT END diff --git a/lib/installer/managers/emerge.sh b/lib/installer/managers/emerge.sh new file mode 100644 index 0000000..59533df --- /dev/null +++ b/lib/installer/managers/emerge.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -f "/etc/gentoo-release" ] + PackageManagerCLT="emerge" + PackageManagerCLTInstallOptions="-s" + PackageManagerCLTRemoveOptions="" + + PackageManagerOutputDevice="/dev/stdout" + + function unprep_package_manager() { + echo "Nothing to unprepare." > $PackageManagerOutputDevice + } + + function prep_package_manager() { + echo "Nothing to prepare." > $PackageManagerOutputDevice + } +fi + +# FLUXSCRIPT END diff --git a/lib/installer/managers/pacman.sh b/lib/installer/managers/pacman.sh new file mode 100644 index 0000000..4465535 --- /dev/null +++ b/lib/installer/managers/pacman.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -f "/etc/arch-release" ] + PackageManagerCLT="pacman" + PackageManagerCLTInstallOptions="-S -y" + PackageManagerCLTRemoveOptions="-Rs" + + PackageManagerOutputDevice="/dev/stdout" + + function unprep_package_manager() { + echo "Nothing to unprepare." > $PackageManagerOutputDevice + } + + function prep_package_manager() { + echo "Nothing to prepare." > $PackageManagerOutputDevice + } +fi + +# FLUXSCRIPT END diff --git a/lib/installer/managers/yum.sh b/lib/installer/managers/yum.sh new file mode 100644 index 0000000..46a1f7b --- /dev/null +++ b/lib/installer/managers/yum.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -f "/etc/redhat-release" ] + PackageManagerCLT="yum" + PackageManagerCLTInstallOptions="-y install" + PackageManagerCLTRemoveOptions="remove" + + PackageManagerOutputDevice="/dev/stdout" + + function unprep_package_manager() { + echo "Nothing to unprepare." > $PackageManagerOutputDevice + } + + function prep_package_manager() { + echo "Nothing to prepare." > $PackageManagerOutputDevice + } +fi + +# FLUXSCRIPT END diff --git a/lib/installer/managers/zypp.sh b/lib/installer/managers/zypp.sh new file mode 100644 index 0000000..2d26121 --- /dev/null +++ b/lib/installer/managers/zypp.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -f "/etc/SuSE-release" ] + PackageManagerCLT="zypp" + PackageManagerCLTInstallOptions="install" + PackageManagerCLTRemoveOptions="remove" + + PackageManagerOutputDevice="/dev/stdout" + + function unprep_package_manager() { + echo "Nothing to unprepare." > $PackageManagerOutputDevice + } + + function prep_package_manager() { + echo "Nothing to prepare." > $PackageManagerOutputDevice + } +fi + +# FLUXSCRIPT END From 92bad0242ba9c27fd8fb2f5797a7aa81411f37c8 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Mon, 21 Aug 2017 00:06:29 -0500 Subject: [PATCH 2/5] Changed & tested update check function. --- lib/installer/InstallerUtils.sh | 43 +++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/lib/installer/InstallerUtils.sh b/lib/installer/InstallerUtils.sh index 7764b54..5a0740c 100644 --- a/lib/installer/InstallerUtils.sh +++ b/lib/installer/InstallerUtils.sh @@ -1,7 +1,7 @@ #!/bin/bash -if [ "$InstallerUtilsVersion" ]; then return 0; fi -readonly InstallerUtilsVersion="1.0" +#if [ "$InstallerUtilsVersion" ]; then return 0; fi +# readonly InstallerUtilsVersion="1.0" InstallerUtilsWorkspacePath="/tmp/verspace" @@ -27,37 +27,50 @@ function installer_utils_run_spinner() { tput cnorm } -# Pamaters: $1 - url $2 - regex +# Pamaters: +# $1 source - Online Info File (text) +# $2 version regex - Online version (regex) +# $3 revision regex - Online version (regex) function installer_utils_check_version() { - if [ ! "$1" ]; then return 1; fi + if [ ${#@} -ne 3 ]; then return 1; fi # Attempt to retrieve versioning information from repository script. - local __installer_utils_check_version__online=("`timeout -s SIGTERM 20 curl "$1" 2>/dev/null | egrep "$2"`") - - if [ "${__installer_utils_check_version__online[@]}" ] - then echo -e "${__installer_utils_check_version__online[@]}" > "$InstallerUtilsWorkspacePath/latest_version" + local -r __installer_utils_check_version__info=("`timeout -s SIGTERM 20 curl "$1" 2> /dev/null`") + + local -r __installer_utils_check_version__onlineVersion=$(echo "${__installer_utils_check_version__info[@]}" | egrep "$2" | egrep -o "[0-9]+") + local -r __installer_utils_check_version__onlineRevision=$(echo "${__installer_utils_check_version__info[@]}" | egrep "$3" | egrep -o "[0-9]+") + + if [ "$__installer_utils_check_version__onlineVersion" ] && [ "$__installer_utils_check_version__onlineRevision" ] + then echo -e "$__installer_utils_check_version__onlineVersion\n$__installer_utils_check_version__onlineRevision" > "$InstallerUtilsWorkspacePath/latest_version" fi } -# Pamaters: $1 - update url $2 - update regex $3 - local version $4 - local revision + +# Pamaters: +# $1 source - Online Info File (text) +# $2 version regex - Online version (regex) +# $3 version local - Local version (number) +# $4 revision regex - Online version (regex) +# $5 revision local - Local version (number) function installer_utils_check_update() { + # The following set of statements aren't very generic, need to be refactored. local versionDialog="Online Version" local versionDialogOffset=$(($(tput cols) / 2 + ((${#versionDialog} / 2) - 4))) printf "%${versionDialogOffset}s" "$versionDialog" - installer_utils_check_version "${@:1:2}" & - installer_utils_run_spinner "$!" + installer_utils_check_version "${@:1:3}" & + installer_utils_run_spinner "$!" # This should be done externally (refactored). - local __installer_utils_check_update__localVersion=$3 - local __installer_utils_check_update__localRevision=$4 + local __installer_utils_check_update__localVersion=$4 + local __installer_utils_check_update__localRevision=$5 local __installer_utils_check_update__version="?" local __installer_utils_check_update__revision="?" if [ -f "$InstallerUtilsWorkspacePath/latest_version" -a \ -s "$InstallerUtilsWorkspacePath/latest_version" ]; then mapfile __installer_utils_check_update__vInfo < "$InstallerUtilsWorkspacePath/latest_version" - __installer_utils_check_update__version=$(echo "${__installer_utils_check_update__vInfo[@]}" | awk -F= 'tolower($1)~/version/{print $2}') - __installer_utils_check_update__revision=$(echo "${__installer_utils_check_update__vInfo[@]}" | awk -F= 'tolower($1)~/revision/{print $2}') + __installer_utils_check_update__version=${__installer_utils_check_update__vInfo[0]} + __installer_utils_check_update__revision=${__installer_utils_check_update__vInfo[1]} fi echo -e "$CClr [$__installer_utils_check_update__version.$__installer_utils_check_update__revision$CClr]" From ecda2bf278cdc74fcd9f9ed4f9c3ee4bd468c8b2 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Mon, 21 Aug 2017 00:11:32 -0500 Subject: [PATCH 3/5] Started fluxion installer update integration. --- fluxion.sh | 208 +++++++++++++++-------------------------------------- 1 file changed, 56 insertions(+), 152 deletions(-) diff --git a/fluxion.sh b/fluxion.sh index 7812fbe..92cb3d9 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -3,50 +3,41 @@ ################################ < FLUXION Parameters > ################################ # NOTE: The FLUXIONPath constant will not be populated correctly if the script is called # directly via a symlink. Symlinks in the path to the script should work completely fine. -FLUXIONPath="$( cd "$(dirname "$0")" ; pwd -P )" +declare -r FLUXIONPath="$( cd "$(dirname "$0")" ; pwd -P )" -FLUXIONWorkspacePath="/tmp/fluxspace" -FLUXIONHashPath="$FLUXIONPath/attacks/Handshake Snooper/handshakes" -FLUXIONScanDB="dump" +declare -r FLUXIONWorkspacePath="/tmp/fluxspace" +declare -r FLUXIONHashPath="$FLUXIONPath/attacks/Handshake Snooper/handshakes" +declare -r FLUXIONScanDB="dump" -FLUXIONNoiseFloor=-90 -FLUXIONNoiseCeiling=-60 +declare -r FLUXIONNoiseFloor=-90 +declare -r FLUXIONNoiseCeiling=-60 -FLUXIONVersion=3 -FLUXIONRevision=1 +declare -r FLUXIONVersion=3 +declare -r FLUXIONRevision=1 -FLUXIONDebug=${FLUXIONDebug:+1} -FLUXIONWIKillProcesses=${FLUXIONWIKillProcesses:+1} -FLUXIONWIReloadDriver=${FLUXIONWIReloadDriver:+1} -FLUXIONAuto=${FLUXIONAuto:+1} +declare -r FLUXIONDebug=${FLUXIONDebug:+1} +declare -r FLUXIONWIKillProcesses=${FLUXIONWIKillProcesses:+1} +declare -r FLUXIONWIReloadDriver=${FLUXIONWIReloadDriver:+1} +declare -r FLUXIONAuto=${FLUXIONAuto:+1} # FLUXIONDebug [Normal Mode "" / Developer Mode 1] -export FLUXIONOutputDevice=$([ $FLUXIONDebug ] && echo "/dev/stdout" || echo "/dev/null") +declare -r FLUXIONOutputDevice=$([ $FLUXIONDebug ] && echo "/dev/stdout" || echo "/dev/null") -FLUXIONHoldXterm=$([ $FLUXIONDebug ] && echo "-hold" || echo "") +declare -r FLUXIONHoldXterm=$([ $FLUXIONDebug ] && echo "-hold" || echo "") -################################# < Shell Color Codes > ################################ -CRed="\e[1;31m" -CGrn="\e[1;32m" -CYel="\e[1;33m" -CBlu="\e[1;34m" -CPrp="\e[5;35m" -CCyn="\e[5;36m" -CGry="\e[0;37m" -CWht="\e[1;37m" -CClr="\e[0m" +################################# < Library Includes > ################################# +source lib/installer/InstallerUtils.sh +source lib/InterfaceUtils.sh +source lib/SandboxUtils.sh +source lib/FormatUtils.sh +source lib/ColorUtils.sh +source lib/IOUtils.sh +source lib/HashUtils.sh ################################ < FLUXION Parameters > ################################ FLUXIONPrompt="$CRed[${CBlu}fluxion$CYel@$CClr$HOSTNAME$CRed]-[$CYel~$CRed]$CClr " FLUXIONVLine="$CRed[$CYel*$CRed]$CClr" -################################# < Library Includes > ################################# -source lib/InterfaceUtils.sh -source lib/SandboxUtils.sh -source lib/FormatUtils.sh -source lib/IOUtils.sh -source lib/HashUtils.sh - source language/English.lang ################################ < Library Parameters > ################################ @@ -55,26 +46,34 @@ InterfaceUtilsOutputDevice="$FLUXIONOutputDevice" SandboxWorkspacePath="$FLUXIONWorkspacePath" SandboxOutputDevice="$FLUXIONOutputDevice" +InstallerUtilsWorkspacePath="$FLUXIONWorkspacePath" +InstallerUtilsOutputDevice="$FLUXIONOutputDevice" +InstallerUtilsNoticeMark="$FLUXIONVLine" + IOUtilsHeader="fluxion_header" IOUtilsQueryMark="$FLUXIONVLine" IOUtilsPrompt="$FLUXIONPrompt" HashOutputDevice="$FLUXIONOutputDevice" -################################# < User Preferences > ################################# -if [ -x "$FLUXIONPath/preferences.sh" ]; then source "$FLUXIONPath/preferences.sh"; fi - -######################################################################################## -if [[ $EUID -ne 0 ]]; then +################################# < Super User Check > ################################# +if [ $EUID -ne 0 ]; then echo -e "${CRed}You don't have admin privilegies, execute the script as root.$CClr" exit 1 fi -if [ -z "${DISPLAY:-}" ]; then +if [ ! "${DISPLAY:-}" ]; then echo -e "${CRed}The script should be exected inside a X (graphical) session.$CClr" - exit 1 + exit 2 fi +################################# < Default Language > ################################# +source language/English.lang + +################################# < User Preferences > ################################# +if [ -x "$FLUXIONPath/preferences.sh" ]; then source "$FLUXIONPath/preferences.sh"; fi + +######################################################################################## function exitmode() { if [ ! $FLUXIONDebug ]; then fluxion_header @@ -157,36 +156,6 @@ function conditional_bail() { read bullshit } -function check_updates() { - # Attempt to retrieve versioning information from repository script. - local FLUXIONOnlineInfo=("`timeout -s SIGTERM 20 curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion.sh" 2>/dev/null | egrep "^(FLUXIONVersion|FLUXIONRevision)"`") - - if [ -z "${FLUXIONOnlineInfo[@]}" ]; then - FLUXIONOnlineInfo=("version=?\n" "revision=?\n") - fi - - echo -e "${FLUXIONOnlineInfo[@]}" > "$FLUXIONWorkspacePath/latest_version" -} - -# Animation -function spinner() { - local pid=$1 - local delay=0.15 - local spinstr='|/-\' - - tput civis - while [ "`ps a | awk '{print $1}' | grep $pid`" ]; do - local temp=${spinstr#?} - printf " [%c] " "$spinstr" - local spinstr=$temp${spinstr%"$temp"} - sleep $delay - printf "\b\b\b\b\b\b" - done - - printf " \b\b\b\b" - tput cnorm -} - # ERROR Report only in Developer Mode function error_report() { echo "Error on line $1" @@ -243,22 +212,23 @@ fi ####################################### < Start > ###################################### if [ ! $FLUXIONDebug ]; then FLUXIONBanner=() - format_center_literals " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; - format_center_literals " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; - format_center_literals " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; - format_center_literals " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; - format_center_literals " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; - format_center_literals "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; + + format_center_literals " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐"; FLUXIONBanner+=("$FormatCenterLiterals"); + format_center_literals " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║"; FLUXIONBanner+=("$FormatCenterLiterals"); + format_center_literals " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜"; FLUXIONBanner+=("$FormatCenterLiterals"); + format_center_literals " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║"; FLUXIONBanner+=("$FormatCenterLiterals"); + format_center_literals " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘"; FLUXIONBanner+=("$FormatCenterLiterals"); + format_center_literals "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"; FLUXIONBanner+=("$FormatCenterLiterals"); clear if [ "$FLUXIONAuto" ] - then echo -e "$CBlu" - else echo -e "$CRed" + then echo -e "$CBlu" + else echo -e "$CRed" fi - for line in "${FLUXIONBanner[@]}"; do - echo "$line"; sleep 0.05 + for line in "${FLUXIONBanner[@]}" + do echo "$line"; sleep 0.05 done #echo "${FLUXIONBanner[@]}" echo @@ -270,84 +240,19 @@ if [ ! $FLUXIONDebug ]; then format_center_literals "${CRed}FLUXION $CWht$FLUXIONVersion (rev. $CGrn$FLUXIONRevision$CWht)$CYel by$CWht ghost"; echo -e "$FormatCenterLiterals" sleep 0.1 - FLUXIONVNotice="Online Version" - FLUXIONVNoticeOffset=$(($(tput cols) / 2 + ((${#FLUXIONVNotice} / 2) - 4))) - printf "%${FLUXIONVNoticeOffset}s" "Online Version" - - check_updates & - spinner "$!" - - if [ -f "$FLUXIONWorkspacePath/latest_version" -a \ - -s "$FLUXIONWorkspacePath/latest_version" ]; then - mapfile FLUXIONOnlineInfo < "$FLUXIONWorkspacePath/latest_version" - FLUXIONOnlineVersion=$(echo "${FLUXIONOnlineInfo[@]}" | awk -F= 'tolower($1)~/version/{print $2}') - FLUXIONOnlineRevision=$(echo "${FLUXIONOnlineInfo[@]}" | awk -F= 'tolower($1)~/revision/{print $2}') - else - FLUXIONOnlineVersion="?" - FLUXIONOnlineRevision="?" + if installer_utils_check_update "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion.sh" "FLUXIONVersion=" "FLUXIONRevision=" $FLUXIONVersion $FLUXIONRevision + then installer_utils_run_update "https://github.com/FluxionNetwork/fluxion/archive/master.zip" "FLUXION-V$FLUXIONVersion.$FLUXIONRevision" "`dirname "$FLUXIONPath"`" fi - echo -e "$CClr [$CPrp$FLUXIONOnlineVersion.$FLUXIONOnlineRevision$CClr]" - - if [ ! -z "${FLUXIONOnlineVersion[@]}" -a \ - "$FLUXIONOnlineVersion" != "?" -a \ - "$FLUXIONOnlineRevision" != "?" ]; then - if [ "$FLUXIONOnlineVersion" -gt "$FLUXIONVersion" -o \ - "$FLUXIONOnlineVersion" -eq "$FLUXIONVersion" -a \ - "$FLUXIONOnlineRevision" -gt "$FLUXIONRevision" ]; then - echo - echo - echo -ne $CRed" New revision found! "$CYel - echo -ne "Update? [Y/n]: "$CClr - read -N1 doupdate - echo -ne "$CClr" - doupdate=${doupdate:-"Y"} - if [ "$doupdate" = "Y" ]; then - cp $0 $HOME/flux_rev-$FLUXIONRevision.backup - curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion" -s -o $0 - echo - echo - echo -e ""$CRed"Updated successfully! Restarting the script to apply the changes ..."$CClr"" - sleep 3 - chmod +x $0 - exec $0 - exit - fi - fi - fi - echo - - sleep 1 + FLUXIONCLIToolsRequired=("aircrack-ng" "awk" "curl" "dhcpd" "hostapd" "lighttpd" "iwconfig" "macchanger" "mdk3" "nmap" "openssl" "php-cgi" "pyrit" "xterm" "rfkill" "unzip" "net-tools" "fuser") + FLUXIONCLIToolsMissing=("software-properties-common" "") + while ! installer_utils_check_dependencies FLUXIONCLIToolsRequired[@] FLUXIONCLIToolsMissing[@] + do installer_utils_run_dependencies FLUXIONCLIToolsMissing[@] + done fi -################################### < Dependencies > ################################### -function check_dependencies() { - local CLITools=("aircrack-ng" "aireplay-ng" "airmon-ng" "airodump-ng" "airbase-ng" "awk" "curl" "dhcpd" "hostapd" "iwconfig" "lighttpd" "macchanger" "mdk3" "nmap" "php-cgi" "pyrit" "xterm" "openssl" "rfkill" "fuser") - - local CLIToolsMissing - - for CLITool in ${CLITools[*]}; do - # Could use parameter replacement, but requires extra variable. - local toolIdentifier=$(printf "%-44s" "$CLITool" | sed 's/ /./g') - local toolState=$(! hash $CLITool 2>/dev/null && echo "$CRed Missing!$CClr" || echo ".....$CGrn OK.$CClr") - CLIToolsMissing=$([[ "$toolState" = *"Missing"* ]] && echo true) - format_center_literals "$FLUXIONVLine $toolIdentifier$toolState" - echo -e "$FormatCenterLiterals" - done - - if [ "$CLIToolsMissing" ]; then - echo - format_center_literals "${CRed}Stopping due to a lack of dependencies!"; echo -e "$FormatCenterLiterals" - echo - exit 1 - fi - - sleep 1 -} - #################################### < Resolution > #################################### -# Windows + Resolution -function set_resolution() { +function set_resolution() { # Windows + Resolution function resA() { TOPLEFT="-geometry 90x13+0+0" TOPRIGHT="-geometry 83x26-0+0" @@ -1067,7 +972,6 @@ function run_attack() { } ################################### < FLUXION Loop > ################################### -check_dependencies set_resolution set_language From c942e0b6db4e3096cf481f35189cc43030615513 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Mon, 21 Aug 2017 15:59:07 -0500 Subject: [PATCH 4/5] Updated site's repository. --- attacks/Captive Portal/sites | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attacks/Captive Portal/sites b/attacks/Captive Portal/sites index 22a2caf..c4a40b4 160000 --- a/attacks/Captive Portal/sites +++ b/attacks/Captive Portal/sites @@ -1 +1 @@ -Subproject commit 22a2cafc3d8272a39bc4efcec0b14ba5b75cd55b +Subproject commit c4a40b40ab14eaefeee1b44bcc8f85a1fe3694e8 From afe1e76690bca197d4108e2810d5308a58d465b5 Mon Sep 17 00:00:00 2001 From: Matias Barcenas Date: Mon, 21 Aug 2017 22:56:41 -0500 Subject: [PATCH 5/5] Completed implementation & integration of installer. The installer has been defined as a utility & is incorporated into fluxion. The installer is now responsible for checking & installing updates. The installer is now responsible for checking & installing dependencies. Package managers can now be defined within fluxion/lib/installer/managers. Dependencies are now flexible, and will attempt alternative installs. --- fluxion.sh | 13 ++++++--- lib/installer/InstallerUtils.sh | 47 +++++++++++++++++-------------- lib/installer/managers/apt-get.sh | 30 -------------------- lib/installer/managers/apt.sh | 33 ++++++++++++++++++++++ lib/installer/managers/emerge.sh | 4 ++- lib/installer/managers/pacman.sh | 4 ++- lib/installer/managers/yum.sh | 4 ++- lib/installer/managers/zypp.sh | 4 ++- 8 files changed, 80 insertions(+), 59 deletions(-) delete mode 100644 lib/installer/managers/apt-get.sh create mode 100644 lib/installer/managers/apt.sh diff --git a/fluxion.sh b/fluxion.sh index b6e079e..bd13a92 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -50,6 +50,8 @@ InstallerUtilsWorkspacePath="$FLUXIONWorkspacePath" InstallerUtilsOutputDevice="$FLUXIONOutputDevice" InstallerUtilsNoticeMark="$FLUXIONVLine" +PackageManagerLog="$InstallerUtilsWorkspacePath/package_manager.log" + IOUtilsHeader="fluxion_header" IOUtilsQueryMark="$FLUXIONVLine" IOUtilsPrompt="$FLUXIONPrompt" @@ -244,10 +246,13 @@ if [ ! $FLUXIONDebug ]; then then installer_utils_run_update "https://github.com/FluxionNetwork/fluxion/archive/master.zip" "FLUXION-V$FLUXIONVersion.$FLUXIONRevision" "`dirname "$FLUXIONPath"`" fi - FLUXIONCLIToolsRequired=("aircrack-ng" "awk" "curl" "dhcpd" "hostapd" "lighttpd" "iwconfig" "macchanger" "mdk3" "nmap" "openssl" "php-cgi" "pyrit" "xterm" "rfkill" "unzip" "net-tools" "fuser") - FLUXIONCLIToolsMissing=("software-properties-common" "") - while ! installer_utils_check_dependencies FLUXIONCLIToolsRequired[@] FLUXIONCLIToolsMissing[@] - do installer_utils_run_dependencies FLUXIONCLIToolsMissing[@] + echo + + FLUXIONCLIToolsRequired=("aircrack-ng" "awk:awk|gawk|mawk" "curl" "dhcpd:isc-dhcp-server" "hostapd" "lighttpd" "iwconfig:wireless-tools" "macchanger" "mdk3" "nmap" "openssl" "php-cgi" "pyrit" "xterm" "rfkill" "unzip" "route:net-tools" "fuser:psmisc" "killall:psmisc") + FLUXIONCLIToolsMissing=() + + while ! installer_utils_check_dependencies FLUXIONCLIToolsRequired[@] + do installer_utils_run_dependencies InstallerUtilsCheckDependencies[@] done fi diff --git a/lib/installer/InstallerUtils.sh b/lib/installer/InstallerUtils.sh index 5a0740c..ce74ab0 100644 --- a/lib/installer/InstallerUtils.sh +++ b/lib/installer/InstallerUtils.sh @@ -9,6 +9,8 @@ InstallerUtilsOutputDevice="/dev/stdout" InstallerUtilsNoticeMark="*" +PackageManagerLog="$InstallerUtilsWorkspacePath/package_manager.log" + function installer_utils_run_spinner() { local pid=$1 local delay=0.15 @@ -68,15 +70,17 @@ function installer_utils_check_update() { if [ -f "$InstallerUtilsWorkspacePath/latest_version" -a \ -s "$InstallerUtilsWorkspacePath/latest_version" ]; then - mapfile __installer_utils_check_update__vInfo < "$InstallerUtilsWorkspacePath/latest_version" + local __installer_utils_check_update__vInfo + mapfile -tn 2 __installer_utils_check_update__vInfo < "$InstallerUtilsWorkspacePath/latest_version" + + sandbox_remove_workfile "$InstallerUtilsWorkspacePath/latest_version" + __installer_utils_check_update__version=${__installer_utils_check_update__vInfo[0]} __installer_utils_check_update__revision=${__installer_utils_check_update__vInfo[1]} fi echo -e "$CClr [$__installer_utils_check_update__version.$__installer_utils_check_update__revision$CClr]" - echo - if [ "$__installer_utils_check_update__version" != "?" -a "$__installer_utils_check_update__revision" != "?" ]; then if [ "$__installer_utils_check_update__version" -gt "$__installer_utils_check_update__localVersion" -o \ "$__installer_utils_check_update__version" -eq "$__installer_utils_check_update__localRevision" -a \ @@ -159,36 +163,35 @@ function installer_utils_run_update() { # Parameters: $1 - CLI Tools required array $2 - CLI Tools missing array (will be populated) function installer_utils_check_dependencies() { - if [ ${#@} -ne 2 ]; then return 1; fi + if [ ! "$1" ]; then return 1; fi - local __installer_utils_run_dependencies__CLITools=("${!1}") - local __installer_utils_run_dependencies__CLIToolsMissing=("${!2}") + local __installer_utils_run_dependencies__CLIToolsInfo=("${!1}") + InstallerUtilsCheckDependencies=() - local __installer_utils_run_dependencies__CLITool - for __installer_utils_run_dependencies__CLITool in "${__installer_utils_run_dependencies__CLITools[@]}"; do + local __installer_utils_run_dependencies__CLIToolInfo + for __installer_utils_run_dependencies__CLIToolInfo in "${__installer_utils_run_dependencies__CLIToolsInfo[@]}"; do + local __installer_utils_run_dependencies__CLITool=${__installer_utils_run_dependencies__CLIToolInfo/:*/} local __installer_utils_run_dependencies__identifier="`printf "%-44s" "$__installer_utils_run_dependencies__CLITool"`" local __installer_utils_run_dependencies__state=".....$CGrn OK.$CClr" if ! hash "$__installer_utils_run_dependencies__CLITool" 2>/dev/null; then __installer_utils_run_dependencies__state="$CRed Missing!$CClr" - __installer_utils_run_dependencies__CLIToolsMissing+=("$__installer_utils_run_dependencies__CLITool") + InstallerUtilsCheckDependencies+=("$__installer_utils_run_dependencies__CLIToolInfo") fi format_center_literals "$InstallerUtilsNoticeMark ${__installer_utils_run_dependencies__identifier// /.}$__installer_utils_run_dependencies__state" echo -e "$FormatCenterLiterals" done - if [ ${#__installer_utils_run_dependencies__CLIToolsMissing[@]} -gt 0 ]; then return 2; fi + if [ ${#InstallerUtilsCheckDependencies[@]} -gt 0 ]; then return 2; fi } # Parameters: $1 - CLI Tools missing array (will be installed) $2 - substitutes array function installer_utils_run_dependencies() { - if [ "${#@}" -ne 2 ]; then return 1; fi + if [ ! "$1" ]; then return 1; fi # The array below holds all the packages that will be installed. - local __installer_utils_run_dependencies__packages=("${!1}") - # The array below holds packages and their substitution. - local __installer_utils_run_dependencies__substitutes=("${!2}") + local __installer_utils_run_dependencies__dependenciesInfo=("${!1}") local __installer_utils_run_dependencies__managers=(lib/installer/managers/*) @@ -206,13 +209,15 @@ function installer_utils_run_dependencies() { prep_package_manager - for __installer_utils_run_dependencies__package in "${__installer_utils_run_dependencies__packages[@]}"; do - clear - local __installer_utils_run_dependencies__target=$__installer_utils_run_dependencies__package - if [ "${__installer_utils_run_dependencies__substitutes[$__installer_utils_run_dependencies__package]}" - then __installer_utils_run_dependencies__target=${__installer_utils_run_dependencies__substitutes[$__installer_utils_run_dependencies__package]} - fi - $PackageManagerCLT $PackageManagerCLTInstallOptions $__installer_utils_run_dependencies__target + for __installer_utils_run_dependencies__dependencyInfo in "${__installer_utils_run_dependencies__dependenciesInfo[@]}"; do + local __installer_utils_run_dependencies__target=${__installer_utils_run_dependencies__dependencyInfo/:*/} + local __installer_utils_run_dependencies__packages=${__installer_utils_run_dependencies__dependencyInfo/*:/} + for __installer_utils_run_dependencies__package in ${__installer_utils_run_dependencies__packages//|/ }; do + clear + if $PackageManagerCLT $PackageManagerCLTInstallOptions $__installer_utils_run_dependencies__package + then break + fi + done done unprep_package_manager diff --git a/lib/installer/managers/apt-get.sh b/lib/installer/managers/apt-get.sh deleted file mode 100644 index 2c5ebda..0000000 --- a/lib/installer/managers/apt-get.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ -f "/etc/debian_version" ] - PackageManagerCLT="apt-get" - PackageManagerCLTInstallOptions="install -y" - PackageManagerCLTRemoveOptions="remove -y" - - PackageManagerOutputDevice="/dev/stdout" - - function unprep_package_manager() { - echo "$(cat /etc/apt/sources.list | grep -v 'deb http://http.kali.org/kali kali-rolling main contrib non-free # Installed By FLUXION')" > /etc/apt/sources.list - } - - function prep_package_manager() { - if [ ! "`(cat /etc/apt/sources.list | grep 'deb http://http.kali.org/kali kali-rolling main contrib non-free'`" ]; then - gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6 - apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6 - echo "deb http://http.kali.org/kali kali-rolling main contrib non-free # Installed By FLUXION" >> /etc/apt/sources.list - fi - - # Cleanup package manager - sudo apt-get install -f -y | tee -a $PackageManagerOutputDevice - sudo apt-get autoremove -y | tee -a $PackageManagerOutputDevice - sudo apt-get autoclean -y | tee -a $PackageManagerOutputDevice - sudo apt-get clean -y | tee -a $PackageManagerOutputDevice - sudo apt-get update | tee -a $PackageManagerOutputDevice - } -fi - -# FLUXSCRIPT END diff --git a/lib/installer/managers/apt.sh b/lib/installer/managers/apt.sh new file mode 100644 index 0000000..bddd297 --- /dev/null +++ b/lib/installer/managers/apt.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ -f "/etc/debian_version" ]; then + PackageManagerCLT="apt" + PackageManagerCLTInstallOptions="install -y" + PackageManagerCLTRemoveOptions="remove -y" + + PackageManagerOutputDevice="/dev/stdout" + + PackageManagerLog="/tmp/lib_package_manager.log" + + function unprep_package_manager() { + echo "`cat /etc/apt/sources.list | grep -v 'deb http://http.kali.org/kali kali-rolling main non-free contrib # Installed By FLUXION'`" > /etc/apt/sources.list + } + + function prep_package_manager() { + if [ ! "`cat /etc/apt/sources.list | egrep 'deb http://http.kali.org/kali ((kali-rolling|main|contrib|non-free) )*'`" ]; then + echo "Doesn't have kali..." + gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6 + apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6 + echo "deb http://http.kali.org/kali kali-rolling main non-free contrib # Installed By FLUXION" >> /etc/apt/sources.list + fi + + # Cleanup package manager + sudo apt-get install -f -y | tee -a $PackageManagerLog + sudo apt-get autoremove -y | tee -a $PackageManagerLog + sudo apt-get autoclean -y | tee -a $PackageManagerLog + sudo apt-get clean -y | tee -a $PackageManagerLog + sudo apt-get update | tee -a $PackageManagerLog + } +fi + +# FLUXSCRIPT END diff --git a/lib/installer/managers/emerge.sh b/lib/installer/managers/emerge.sh index 59533df..22ada1b 100644 --- a/lib/installer/managers/emerge.sh +++ b/lib/installer/managers/emerge.sh @@ -1,12 +1,14 @@ #!/bin/bash -if [ -f "/etc/gentoo-release" ] +if [ -f "/etc/gentoo-release" ]; then PackageManagerCLT="emerge" PackageManagerCLTInstallOptions="-s" PackageManagerCLTRemoveOptions="" PackageManagerOutputDevice="/dev/stdout" + PackageManagerLog="/tmp/lib_package_manager.log" + function unprep_package_manager() { echo "Nothing to unprepare." > $PackageManagerOutputDevice } diff --git a/lib/installer/managers/pacman.sh b/lib/installer/managers/pacman.sh index 4465535..ea176e3 100644 --- a/lib/installer/managers/pacman.sh +++ b/lib/installer/managers/pacman.sh @@ -1,12 +1,14 @@ #!/bin/bash -if [ -f "/etc/arch-release" ] +if [ -f "/etc/arch-release" ]; then PackageManagerCLT="pacman" PackageManagerCLTInstallOptions="-S -y" PackageManagerCLTRemoveOptions="-Rs" PackageManagerOutputDevice="/dev/stdout" + PackageManagerLog="/tmp/lib_package_manager.log" + function unprep_package_manager() { echo "Nothing to unprepare." > $PackageManagerOutputDevice } diff --git a/lib/installer/managers/yum.sh b/lib/installer/managers/yum.sh index 46a1f7b..2343611 100644 --- a/lib/installer/managers/yum.sh +++ b/lib/installer/managers/yum.sh @@ -1,12 +1,14 @@ #!/bin/bash -if [ -f "/etc/redhat-release" ] +if [ -f "/etc/redhat-release" ]; then PackageManagerCLT="yum" PackageManagerCLTInstallOptions="-y install" PackageManagerCLTRemoveOptions="remove" PackageManagerOutputDevice="/dev/stdout" + PackageManagerLog="/tmp/lib_package_manager.log" + function unprep_package_manager() { echo "Nothing to unprepare." > $PackageManagerOutputDevice } diff --git a/lib/installer/managers/zypp.sh b/lib/installer/managers/zypp.sh index 2d26121..25f9db2 100644 --- a/lib/installer/managers/zypp.sh +++ b/lib/installer/managers/zypp.sh @@ -1,12 +1,14 @@ #!/bin/bash -if [ -f "/etc/SuSE-release" ] +if [ -f "/etc/SuSE-release" ]; then PackageManagerCLT="zypp" PackageManagerCLTInstallOptions="install" PackageManagerCLTRemoveOptions="remove" PackageManagerOutputDevice="/dev/stdout" + PackageManagerLog="/tmp/lib_package_manager.log" + function unprep_package_manager() { echo "Nothing to unprepare." > $PackageManagerOutputDevice }