Skip to content

Added the possibility to use Alpine as OS #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion bin/installfog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,30 @@ if [[ ! $EUID -eq 0 ]]; then
echo "FOG Installation must be run as root user"
exit 1
fi
which useradd >/dev/null 2>&1

[[ -z $OS ]] && OS=$(uname -s)
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
if [[ -f /etc/os-release ]]; then
[[ -z $linuxReleaseName ]] && linuxReleaseName=$(sed -n 's/^NAME=\(.*\)/\1/p' /etc/os-release | tr -d '"')
[[ -z $OSVersion ]] && OSVersion=$(sed -n 's/^VERSION_ID=\([^.]*\).*/\1/p' /etc/os-release | tr -d '"')
elif [[ -f /etc/redhat-release ]]; then
[[ -z $linuxReleaseName ]] && linuxReleaseName=$(cat /etc/redhat-release | awk '{print $1}')
[[ -z $OSVersion ]] && OSVersion=$(cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*// | awk -F. '{print $1}')
elif [[ -f /etc/debian_version ]]; then
[[ -z $linuxReleaseName ]] && linuxReleaseName='Debian'
[[ -z $OSVersion ]] && OSVersion=$(cat /etc/debian_version)
fi
fi

if [[ $linuxReleaseName == "Alpine Linux" ]]; then
echo "Linuxname = ${linuxReleaseName}"
which adduser >/dev/null 2>&1
else
which useradd >/dev/null 2>&1
fi
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 @@ -360,6 +383,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
54 changes: 54 additions & 0 deletions lib/alpine/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/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 nginx 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}"
4 changes: 4 additions & 0 deletions lib/common/config.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# lib/common/config.sh
# FOG is a computer imaging solution.
# Copyright (C) 2007 Chuck Syperski & Jian Zhang
#
Expand Down Expand Up @@ -72,6 +73,9 @@ else
*[Uu][Bb][Uu][Nn][Tt][Uu]*|*[Bb][Ii][Aa][Nn]*|*[Mm][Ii][Nn][Tt]*)
initdsrc="../packages/init.d/ubuntu"
;;
*[Aa][Ll][Pp][Ii][Nn][Ee]*)
initdsrc="../packages/init.d/alpine"
;;
*)
initdsrc="../packages/init.d/redhat"
;;
Expand Down
Loading