Skip to content

Commit

Permalink
Add alpine adn allow redhat tested nginx isntead of solely apache per…
Browse files Browse the repository at this point in the history
… PR #438, thanks @redvex2460
  • Loading branch information
Sebastian-Roth authored and mastacontrola committed Jul 18, 2021
1 parent befaaee commit 0e91cb8
Show file tree
Hide file tree
Showing 16 changed files with 590 additions and 160 deletions.
10 changes: 8 additions & 2 deletions bin/installfog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ if [[ ! $EUID -eq 0 ]]; then
echo "FOG Installation must be run as root user"
exit 1 # Fail Sudo
fi
which useradd >/dev/null 2>&1
# Begin adjusting per @redvex2460 in PR 438
# Use a more appropriate method for user add command lookup
[[ -z $useraddcmd ]] && useraddcmd=$(command -v useradd) || true
[[ -z $useraddcmd ]] && useraddcmd=$(command -v adduser) || true
if [[ $? -eq 1 || $(echo $PATH | grep -o "sbin" | wc -l) -lt 2 ]]; then
echo "Please switch to a proper root environment to run the installer!"
echo "Use 'sudo -i' or 'su -' (skip the ' and note the hyphen at the end"
Expand Down Expand Up @@ -320,7 +323,8 @@ while getopts "$optspec" o; do
done
[[ -z $version ]] && version="$(awk -F\' /"define\('FOG_VERSION'[,](.*)"/'{print $4}' ../packages/web/lib/fog/system.class.php | tr -d '[[:space:]]')"
[[ -z $OS ]] && OS=$(uname -s)
if [[ $OS =~ ^[^Ll][^Ii][^Nn][^Uu][^Xx] ]]; then
# Minor change to do our checks here.
if [[ $OS =~ [^Ll][^Ii][^Nn][^Uu][^Xx] ]]; then
echo "We do not currently support Installation on non-Linux Operating Systems"
exit 2 # Fail OS Check
else
Expand Down Expand Up @@ -360,6 +364,8 @@ if [[ ! $exitcode -eq 0 ]]; then
*[Aa][Rr][Cc][Hh]*)
pacman -Sy --noconfirm lsb-release >>$workingdir/error_logs/fog_error_${version}.log 2>&1
;;
*[Aa][Ll][Pp][Ii][Nn][Ee]*)
;;
esac
fi
[[ -z $OSVersion ]] && OSVersion=$(lsb_release -r| awk -F'[^0-9]*' /^[Rr]elease\([^.]*\).*/'{print $2}')
Expand Down
56 changes: 56 additions & 0 deletions lib/alpine/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
# lib/alpine/config.sh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
[[ -z $packages ]] && packages="openrc bc cdrkit curl gcc g++ git gzip lftp m4 make mariadb mariadb-client net-tools nfs-utils openssh openssl perl perl-crypt-passwdmd5 php7 php7-session php7-fpm php7-mbstring php7-mcrypt php7-soap php7-openssl php7-gmp php7-pdo_odbc php7-json php7-dom php7-pdo php7-zip php7-mysqli php7-sqlite3 php7-apcu php7-pdo_pgsql php7-bcmath php7-gd php7-odbc php7-pdo_mysql php7-pdo_sqlite php7-gettext php7-xmlreader php7-xmlrpc php7-bz2 php7-iconv php7-pdo_dblib php7-curl php7-sockets php7-mysqli php7-ctype syslinux tar tftp-hpa vsftpd wget xz"
[[ -z $packageinstaller ]] && packageinstaller="apk add"
[[ -z $packagelist ]] && packagelist="apk info"
[[ -z $packageupdater ]] && packageupdater="apk update && apk upgrade"
[[ -z $packmanUpdate ]] && packmanUpdate="$packageinstaller"
[[ -z $packageQuery ]] && packageQuery="apk info -e \$x "
[[ -z $langPackages ]] && langPackages="iso-codes"
[[ -z $dhcpname ]] && dhcpname=""
if [[ -z $webdirdest ]]; then
if [[ -z $docroot ]]; then
docroot="/var/www/"
webdirdest="${docroot}fog/"
elif [[ "$docroot" != *'fog'* ]]; then
webdirdest="${docroot}fog/"
else
webdirdest="${docroot}/"
fi
fi
[[ -z $webredirect ]] && webredirect="${webdirdest}/index.php"
[[ -z $apacheuser ]] && apacheuser="nginx"
[[ -z $apachelogdir ]] && apachelogdir="/var/log/nginx"
[[ -z $apacheerrlog ]] && apacheerrlog="$apachelogdir/error.log"
[[ -z $apacheacclog ]] && apacheacclog="$apachelogdir/access.log"
[[ -z $httpdconf ]] && httpdconf="/etc/nginx/nginx.conf"
[[ -z $etcconf ]] && etcconf="/etc/nginx/http.d/default.conf"
[[ -z $phpini ]] && phpini="/etc/php7/php.ini"
[[ -z $storageLocation ]] && storageLocation="/images"
[[ -z $storageLocationCapture ]] && storageLocationCapture="${storageLocation}/dev"
[[ -z $dhcpconfig ]] && dhcpconfig="/etc/dhcpd.conf"
[[ -z $dhcpconfigother ]] && dhcpconfigother="/etc/dhcp/dhcpd.conf"
[[ -z $tftpdirdst ]] && tftpdirdst="/var/tftpboot"
[[ -z $tftpconfig ]] && tftpconfig="/etc/xinetd.d/tftpd"
[[ -z $ftpxinetd ]] && ftpxinetd="/etc/xinetd.d/vsftpd"
[[ -z $ftpconfig ]] && ftpconfig="/etc/vsftpd.conf"
[[ -z $dhcpd ]] && dhcpd="dhcpd4"
[[ -z $snapindir ]] && snapindir="/opt/fog/snapins"
[[ -z $php_ver ]] && php_ver="7"
[[ -z $phpfpm ]] && phpfpm="php-fpm${php_ver}"
[[ -z $webserver ]] && webserver="nginx"
packages="${packages} ${webserver}"
17 changes: 13 additions & 4 deletions lib/arch/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
[[ -z $packages ]] && packages="apache bc cdrtools curl dhcp gcc git gzip lftp m4 make mariadb mod_fastcgi net-tools nfs-utils openssh openssl perl perl-crypt-passwdmd5 php php-apache php-fpm php-gd syslinux tar tftp-hpa vsftpd wget xinetd xz"
[[ -z $packages ]] && packages="bc cdrtools curl dhcp gcc git gzip lftp m4 make mariadb mod_fastcgi net-tools nfs-utils openssh openssl perl perl-crypt-passwdmd5 php php-apache php-fpm php-gd syslinux tar tftp-hpa vsftpd wget xinetd xz"
[[ -z $packageinstaller ]] && packageinstaller="pacman -Sy --noconfirm"
[[ -z $packagelist ]] && packagelist="pacman -Si"
[[ -z $packageupdater ]] && packageupdater="pacman -Syu --noconfirm"
Expand All @@ -31,13 +31,21 @@ if [[ -z $webdirdest ]]; then
webdirdest="${docroot}/"
fi
fi
[[ -z $webserver ]] && webserver="apache"
[[ -z $webredirect ]] && webredirect="${webdirdest}/index.php"
[[ -z $apacheuser ]] && apacheuser="http"
[[ -z $apachelogdir ]] && apachelogdir="/var/log/httpd"
if [[ $webserver == "apache" ]]; then
[[ -z $apachelogdir ]] && apachelogdir="/var/log/httpd"
[[ -z $httpdconf ]] && httpdconf="/etc/httpd/conf/httpd.conf"
[[ -z $etcconf ]] && etcconf="/etc/httpd/conf/extra/fog.conf"
else
# This is all just a guess, will most likely need a ton of refinement
[[ -z $apachelogdir ]] && apachelogdir="/var/log/$webserver"
[[ -z $httpdconf ]] && httpdconf="/etc/$webserver/conf/httpd.conf"
[[ -z $etcconf ]] && etcconf="/etc/$webserver/conf/extra/fog.conf"
fi
[[ -z $apacheerrlog ]] && apacheerrlog="$apachelogdir/error_log"
[[ -z $apacheacclog ]] && apacheacclog="$apachelogdir/access_log"
[[ -z $httpdconf ]] && httpdconf="/etc/httpd/conf/httpd.conf"
[[ -z $etcconf ]] && etcconf="/etc/httpd/conf/extra/fog.conf"
[[ -z $phpini ]] && phpini="/etc/php/php.ini"
[[ -z $storageLocation ]] && storageLocation="/images"
[[ -z $storageLocationCapture ]] && storageLocationCapture="${storageLocation}/dev"
Expand All @@ -49,3 +57,4 @@ fi
[[ -z $ftpconfig ]] && ftpconfig="/etc/vsftpd.conf"
[[ -z $dhcpd ]] && dhcpd="dhcpd4"
[[ -z $snapindir ]] && snapindir="/opt/fog/snapins"
packages="${packages} ${webserver}"
Loading

0 comments on commit 0e91cb8

Please sign in to comment.