Skip to content

Commit

Permalink
Add hopeful method to list-packages as requested in #576
Browse files Browse the repository at this point in the history
  • Loading branch information
mastacontrola committed Jul 19, 2024
1 parent 2c71996 commit d078d40
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 3 deletions.
11 changes: 9 additions & 2 deletions bin/installfog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ usage() {
echo -e "\t-T --no-tftpbuild\t\tDo not rebuild the tftpd config file"
echo -e "\t-F --no-vhost\t\tDo not overwrite vhost file"
echo -e "\t-A --arm-support\t\tInstall kernel and initrd for ARM platforms"
echo -e "\t-l --list-packages\t\tList of the basic packages FOG needs for install or is currently installed for FOG"
exit 0
}

shortopts="h?odEUHSCKYyXxTPFAf:c:W:D:B:s:e:b:N:"
longopts="help,uninstall,ssl-path:,oldcopy,no-vhost,no-defaults,no-upgrade,no-htmldoc,force-https,recreate-keys,recreate-CA,recreate-Ca,recreate-cA,recreate-ca,autoaccept,file:,docroot:,webroot:,backuppath:,startrange:,endrange:,bootfile:,no-exportbuild,exitFail,no-tftpbuild,arm-support"
shortopts="h?odEUHSCKYyXxTPFAf:c:W:D:B:s:e:b:N:l"
longopts="help,uninstall,ssl-path:,oldcopy,no-vhost,no-defaults,no-upgrade,no-htmldoc,force-https,recreate-keys,recreate-CA,recreate-Ca,recreate-cA,recreate-ca,autoaccept,file:,docroot:,webroot:,backuppath:,startrange:,endrange:,bootfile:,no-exportbuild,exitFail,no-tftpbuild,arm-support,list-packages"

optargs=$(getopt -o $shortopts -l $longopts -n "$0" -- "$@")
[[ $? -ne 0 ]] && usage
Expand Down Expand Up @@ -228,6 +229,10 @@ while :; do
sarmsupport=1
shift
;;
-l | --list-packages)
listPackages=1
shift
;;
--)
shift
break
Expand All @@ -248,6 +253,7 @@ elif [[ -f /etc/debian_version ]]; then
fi

linuxReleaseName_lower=$(echo "$linuxReleaseName" | tr [:upper:] [:lower:])
listPackages

echo "Installing LSB_Release as needed"
dots "Attempting to get release information"
Expand Down Expand Up @@ -392,6 +398,7 @@ echo " * Interface: $interface"
echo " * Server IP Address: $ipaddress"
echo " * Server Subnet Mask: $submask"
echo " * Hostname: $hostname"
echo
case $installtype in
N)
echo " * Installation Type: Normal Server"
Expand Down
126 changes: 126 additions & 0 deletions lib/common/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,129 @@ getAllNetworkInterfaces() {
fi
echo -n $interfaces
}
listPackages() {
if [[ $listPackages != 1 ]]; then
return
fi
. ../lib/common/config.sh
[[ -z $fogpriorconfig ]] && fogpriorconfig="$fogprogramdir/.fogsettings"
if [[ -f $fogpriorconfig ]]; then
. "$fogpriorconfig"
case $osid in
1)
osname="Redhat"
. ../lib/redhat/config.sh
;;
2)
osname="Debian"
. ../lib/ubuntu/config.sh
;;
3)
osname="Alpine"
. ../lib/alpine/config.sh
;;
esac
else
case $linuxReleaseName_lower in
*fedora*|*red*hat*|*centos*|*mageia*|*alma*|*rocky*)
osid=1
osname="Redhat"
. ../lib/redhat/config.sh
;;
*ubuntu*|*bian*|*mint*)
osid=2
osname="Debian"
. ../lib/ubuntu/config.sh
;;
*alpine*)
osid=3
osname="Alpine"
. ../lib/alpine/config.sh
;;
*)
echo "Could not define OS"
exit 1
;;
esac
fi
if [[ $ignorehtmldoc -eq 1 ]]; then
[[ -z $newpackagelist ]] && newpackagelist=""
for z in $packages; do
[[ -$z != htmldoc ]] && newpackagelist="$newpackagelist $z"
done
packages=$(echo $newpackagelist)
fi
if [[ $bldhcp == 0 ]]; then
[[ -z $newpackagelist ]] && newpackagelist=""
for z in $packages; do
[[ -$z != $dhcpname ]] && newpackagelist="$newpackagelist $z"
done
packages=$(echo $newpackagelist)
fi
case $installtype in
[Ss])
packages=$(echo $packages | sed -e 's/[-a-zA-Z]*dhcp[-a-zA-Z]*//g')
;;
esac
packages="$packages jq unzip attr ${webserver}"
case $osid in
1)
packages="$packages php-bcmath bc"
if [[ $installlang -eq 1 ]]; then
packages="$packages php-intl"
for i in fr de eu es pt zh en; do
packages="$packages glibc-langpack-${i}"
done
fi
packages="${packages// mod_fastcgi/}"
packages="${packages// mod_evasive/}"
packages="${packages// php-mcrypt/}"
case $linuxReleaseName_lower in
*fedora*)
packages="$packages php-json"
packages="${packages// mysql / mariadb }"
packages="${packages// mysql-server / mariadb-server }"
packages="${packages// dhcp / dhcp-server }"
esac
;;
2)
if [[ $webserver == "apache2" ]]; then
packages="${packages// libapache2-mod-fastcgi/}"
packages="${packages// libapache2-mod-evasive/}"
fi
packages="${packages// xinetd/}"
packages="${packages// php-gettext/}"
packages="${packages// php-php-gettext/}"
if [[ $installlang -eq 1 ]]; then
packages="$packages php-intl"
if [[ $installlang -eq 1 ]]; then
for i in fr de eu es pt zh-hans en; do
packages="$packages language-pack-${i}"
done
fi
fi
case $linuxReleaseName_lower in
*ubuntu*|*mint*)
if [[ $OSVersion -gt 17 ]]; then
packages="${packages// libcurl3 / libcurl4}"
fi
if [[ $OSVersion -gt 22 ]]; then
packages="${packages// libcurl4 / libcurl4t64}"
fi
esac
;;
*bian*)
if [[ $OSVersion -ge 10 ]]; then
packages="${packages// libcurl3 / libcurl4}"
packages="${packages// mysql-client / mariadb-client}"
packages="${packages// mysql-server / mariadb-server}"
fi
;;
esac
packages=$(echo ${packages[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')
echo $packages;
exit 0;
}
checkInternetConnection() {
dots "Testing internet connection"
DEBIAN_FRONTEND=noninteractive $packageinstaller curl >>$error_log 2>&1
Expand Down Expand Up @@ -743,6 +866,9 @@ installPackages() {
if [[ $OSVersion -gt 17 ]]; then
packages="${packages// libcurl3 / libcurl4 }">>$error_log 2>&1
fi
if [[ $OSVersion -gt 22 ]]; then
packages="${packages// libcurl4 / libcurl4t64 }">>$error_log 2>&1
fi
if [[ $linuxReleaseName_lower == +(*ubuntu*) && $OSVersion -ge 18 ]]; then
# Fix missing universe section for Ubuntu 18.04 LIVE
LANG='en_US.UTF-8' LC_ALL='en_US.UTF-8' add-apt-repository -y universe >>$error_log 2>&1
Expand Down
2 changes: 1 addition & 1 deletion packages/web/lib/fog/system.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private static function _versionCompare()
public function __construct()
{
self::_versionCompare();
define('FOG_VERSION', '1.6.0-alpha.1371');
define('FOG_VERSION', '1.6.0-alpha.1372');
define('FOG_CHANNEL', 'Alpha');
define('FOG_SCHEMA', 290);
define('FOG_BCACHE_VER', 147);
Expand Down

0 comments on commit d078d40

Please sign in to comment.