Skip to content

Commit 7e5b8f3

Browse files
Sebastian-Rothmastacontrola
authored andcommitted
Add alpine adn allow redhat tested nginx isntead of solely apache per PR #438, thanks @redvex2460
1 parent e1ce555 commit 7e5b8f3

16 files changed

+590
-160
lines changed

bin/installfog.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ if [[ ! $EUID -eq 0 ]]; then
2323
echo "FOG Installation must be run as root user"
2424
exit 1 # Fail Sudo
2525
fi
26-
which useradd >/dev/null 2>&1
26+
# Begin adjusting per @redvex2460 in PR 438
27+
# Use a more appropriate method for user add command lookup
28+
[[ -z $useraddcmd ]] && useraddcmd=$(command -v useradd) || true
29+
[[ -z $useraddcmd ]] && useraddcmd=$(command -v adduser) || true
2730
if [[ $? -eq 1 || $(echo $PATH | grep -o "sbin" | wc -l) -lt 2 ]]; then
2831
echo "Please switch to a proper root environment to run the installer!"
2932
echo "Use 'sudo -i' or 'su -' (skip the ' and note the hyphen at the end"
@@ -320,7 +323,8 @@ while getopts "$optspec" o; do
320323
done
321324
[[ -z $version ]] && version="$(awk -F\' /"define\('FOG_VERSION'[,](.*)"/'{print $4}' ../packages/web/lib/fog/system.class.php | tr -d '[[:space:]]')"
322325
[[ -z $OS ]] && OS=$(uname -s)
323-
if [[ $OS =~ ^[^Ll][^Ii][^Nn][^Uu][^Xx] ]]; then
326+
# Minor change to do our checks here.
327+
if [[ $OS =~ [^Ll][^Ii][^Nn][^Uu][^Xx] ]]; then
324328
echo "We do not currently support Installation on non-Linux Operating Systems"
325329
exit 2 # Fail OS Check
326330
else
@@ -360,6 +364,8 @@ if [[ ! $exitcode -eq 0 ]]; then
360364
*[Aa][Rr][Cc][Hh]*)
361365
pacman -Sy --noconfirm lsb-release >>$workingdir/error_logs/fog_error_${version}.log 2>&1
362366
;;
367+
*[Aa][Ll][Pp][Ii][Nn][Ee]*)
368+
;;
363369
esac
364370
fi
365371
[[ -z $OSVersion ]] && OSVersion=$(lsb_release -r| awk -F'[^0-9]*' /^[Rr]elease\([^.]*\).*/'{print $2}')

lib/alpine/config.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# lib/alpine/config.sh
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
#
17+
[[ -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"
18+
[[ -z $packageinstaller ]] && packageinstaller="apk add"
19+
[[ -z $packagelist ]] && packagelist="apk info"
20+
[[ -z $packageupdater ]] && packageupdater="apk update && apk upgrade"
21+
[[ -z $packmanUpdate ]] && packmanUpdate="$packageinstaller"
22+
[[ -z $packageQuery ]] && packageQuery="apk info -e \$x "
23+
[[ -z $langPackages ]] && langPackages="iso-codes"
24+
[[ -z $dhcpname ]] && dhcpname=""
25+
if [[ -z $webdirdest ]]; then
26+
if [[ -z $docroot ]]; then
27+
docroot="/var/www/"
28+
webdirdest="${docroot}fog/"
29+
elif [[ "$docroot" != *'fog'* ]]; then
30+
webdirdest="${docroot}fog/"
31+
else
32+
webdirdest="${docroot}/"
33+
fi
34+
fi
35+
[[ -z $webredirect ]] && webredirect="${webdirdest}/index.php"
36+
[[ -z $apacheuser ]] && apacheuser="nginx"
37+
[[ -z $apachelogdir ]] && apachelogdir="/var/log/nginx"
38+
[[ -z $apacheerrlog ]] && apacheerrlog="$apachelogdir/error.log"
39+
[[ -z $apacheacclog ]] && apacheacclog="$apachelogdir/access.log"
40+
[[ -z $httpdconf ]] && httpdconf="/etc/nginx/nginx.conf"
41+
[[ -z $etcconf ]] && etcconf="/etc/nginx/http.d/default.conf"
42+
[[ -z $phpini ]] && phpini="/etc/php7/php.ini"
43+
[[ -z $storageLocation ]] && storageLocation="/images"
44+
[[ -z $storageLocationCapture ]] && storageLocationCapture="${storageLocation}/dev"
45+
[[ -z $dhcpconfig ]] && dhcpconfig="/etc/dhcpd.conf"
46+
[[ -z $dhcpconfigother ]] && dhcpconfigother="/etc/dhcp/dhcpd.conf"
47+
[[ -z $tftpdirdst ]] && tftpdirdst="/var/tftpboot"
48+
[[ -z $tftpconfig ]] && tftpconfig="/etc/xinetd.d/tftpd"
49+
[[ -z $ftpxinetd ]] && ftpxinetd="/etc/xinetd.d/vsftpd"
50+
[[ -z $ftpconfig ]] && ftpconfig="/etc/vsftpd.conf"
51+
[[ -z $dhcpd ]] && dhcpd="dhcpd4"
52+
[[ -z $snapindir ]] && snapindir="/opt/fog/snapins"
53+
[[ -z $php_ver ]] && php_ver="7"
54+
[[ -z $phpfpm ]] && phpfpm="php-fpm${php_ver}"
55+
[[ -z $webserver ]] && webserver="nginx"
56+
packages="${packages} ${webserver}"

lib/arch/config.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# You should have received a copy of the GNU General Public License
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
#
16-
[[ -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"
16+
[[ -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"
1717
[[ -z $packageinstaller ]] && packageinstaller="pacman -Sy --noconfirm"
1818
[[ -z $packagelist ]] && packagelist="pacman -Si"
1919
[[ -z $packageupdater ]] && packageupdater="pacman -Syu --noconfirm"
@@ -31,13 +31,21 @@ if [[ -z $webdirdest ]]; then
3131
webdirdest="${docroot}/"
3232
fi
3333
fi
34+
[[ -z $webserver ]] && webserver="apache"
3435
[[ -z $webredirect ]] && webredirect="${webdirdest}/index.php"
3536
[[ -z $apacheuser ]] && apacheuser="http"
36-
[[ -z $apachelogdir ]] && apachelogdir="/var/log/httpd"
37+
if [[ $webserver == "apache" ]]; then
38+
[[ -z $apachelogdir ]] && apachelogdir="/var/log/httpd"
39+
[[ -z $httpdconf ]] && httpdconf="/etc/httpd/conf/httpd.conf"
40+
[[ -z $etcconf ]] && etcconf="/etc/httpd/conf/extra/fog.conf"
41+
else
42+
# This is all just a guess, will most likely need a ton of refinement
43+
[[ -z $apachelogdir ]] && apachelogdir="/var/log/$webserver"
44+
[[ -z $httpdconf ]] && httpdconf="/etc/$webserver/conf/httpd.conf"
45+
[[ -z $etcconf ]] && etcconf="/etc/$webserver/conf/extra/fog.conf"
46+
fi
3747
[[ -z $apacheerrlog ]] && apacheerrlog="$apachelogdir/error_log"
3848
[[ -z $apacheacclog ]] && apacheacclog="$apachelogdir/access_log"
39-
[[ -z $httpdconf ]] && httpdconf="/etc/httpd/conf/httpd.conf"
40-
[[ -z $etcconf ]] && etcconf="/etc/httpd/conf/extra/fog.conf"
4149
[[ -z $phpini ]] && phpini="/etc/php/php.ini"
4250
[[ -z $storageLocation ]] && storageLocation="/images"
4351
[[ -z $storageLocationCapture ]] && storageLocationCapture="${storageLocation}/dev"
@@ -49,3 +57,4 @@ fi
4957
[[ -z $ftpconfig ]] && ftpconfig="/etc/vsftpd.conf"
5058
[[ -z $dhcpd ]] && dhcpd="dhcpd4"
5159
[[ -z $snapindir ]] && snapindir="/opt/fog/snapins"
60+
packages="${packages} ${webserver}"

0 commit comments

Comments
 (0)