installfog.sh (fogproject-1.5.7) | : | installfog.sh (fogproject-1.5.8) | ||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
# | # | |||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | |||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
# | # | |||
bindir=$(dirname $(readlink -f "$BASH_SOURCE") ) | bindir=$(dirname $(readlink -f "$BASH_SOURCE") ) | |||
cd $bindir | cd $bindir | |||
workingdir=$(pwd) | workingdir=$(pwd) | |||
if [[ ! $EUID -eq 0 ]]; then | if [[ ! $EUID -eq 0 ]]; then | |||
exec sudo $0 $@ || echo "FOG Installation must be run as root user" | echo "FOG Installation must be run as root user" | |||
exit 1 # Fail Sudo | exit 1 | |||
fi | ||||
which useradd >/dev/null 2>&1 | ||||
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 (e.g. | ||||
sudo -i)" | ||||
exit 1 | ||||
fi | fi | |||
. ../lib/common/functions.sh | . ../lib/common/functions.sh | |||
help() { | help() { | |||
echo -e "Usage: $0 [-h?dEUuHSCKYXT] [-f <filename>]" | echo -e "Usage: $0 [-h?dEUuHSCKYXTFA] [-f <filename>] [-N <databasename>]" | |||
echo -e "\t\t[-D </directory/to/document/root/>] [-c <ssl-path>]" | echo -e "\t\t[-D </directory/to/document/root/>] [-c <ssl-path>]" | |||
echo -e "\t\t[-W <webroot/to/fog/after/docroot/>] [-B </backup/path/>]" | echo -e "\t\t[-W <webroot/to/fog/after/docroot/>] [-B </backup/path/>]" | |||
echo -e "\t\t[-s <192.168.1.10>] [-e <192.168.1.254>] [-b <undionly.kpxe>]" | echo -e "\t\t[-s <192.168.1.10>] [-e <192.168.1.254>] [-b <undionly.kpxe>]" | |||
echo -e "\t-h -? --help\t\t\tDisplay this info" | echo -e "\t-h -? --help\t\t\tDisplay this info" | |||
echo -e "\t-o --oldcopy\t\t\tCopy back old data" | echo -e "\t-o --oldcopy\t\t\tCopy back old data" | |||
echo -e "\t-d --no-defaults\t\tDon't guess defaults" | echo -e "\t-d --no-defaults\t\tDon't guess defaults" | |||
echo -e "\t-U --no-upgrade\t\tDon't attempt to upgrade" | echo -e "\t-U --no-upgrade\t\tDon't attempt to upgrade" | |||
echo -e "\t-H --no-htmldoc\t\tNo htmldoc, means no PDFs" | echo -e "\t-H --no-htmldoc\t\tNo htmldoc, means no PDFs" | |||
echo -e "\t-S --force-https\t\tForce HTTPS for all comunication" | echo -e "\t-S --force-https\t\tForce HTTPS for all comunication" | |||
echo -e "\t-C --recreate-CA\t\tRecreate the CA Keys" | echo -e "\t-C --recreate-CA\t\tRecreate the CA Keys" | |||
skipping to change at line 58 | skipping to change at line 63 | |||
echo -e "\t \t\t\t\t http://127.0.0.1/)" | echo -e "\t \t\t\t\t http://127.0.0.1/)" | |||
echo -e "\t \t\t\t\tDefaults to /fog/" | echo -e "\t \t\t\t\tDefaults to /fog/" | |||
echo -e "\t-B --backuppath\t\tSpecify the backup path" | echo -e "\t-B --backuppath\t\tSpecify the backup path" | |||
echo -e "\t --uninstall\t\tUninstall FOG" | echo -e "\t --uninstall\t\tUninstall FOG" | |||
echo -e "\t-s --startrange\t\tDHCP Start range" | echo -e "\t-s --startrange\t\tDHCP Start range" | |||
echo -e "\t-e --endrange\t\tDHCP End range" | echo -e "\t-e --endrange\t\tDHCP End range" | |||
echo -e "\t-b --bootfile\t\tDHCP Boot file" | echo -e "\t-b --bootfile\t\tDHCP Boot file" | |||
echo -e "\t-E --no-exportbuild\t\tSkip building nfs file" | echo -e "\t-E --no-exportbuild\t\tSkip building nfs file" | |||
echo -e "\t-X --exitFail\t\tDo not exit if item fails" | echo -e "\t-X --exitFail\t\tDo not exit if item fails" | |||
echo -e "\t-T --no-tftpbuild\t\tDo not rebuild the tftpd config file" | echo -e "\t-T --no-tftpbuild\t\tDo not rebuild the tftpd config file" | |||
echo -e "\t-P --no-pxedefault\t\tDo not overwrite pxe default file" | ||||
echo -e "\t-F --no-vhost\t\tDo not overwrite vhost 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 platform s" | ||||
exit 0 | exit 0 | |||
} | } | |||
optspec="h?odEUHSCKYyXxTPFf:c:-:W:D:B:s:e:b:" | optspec="h?odEUHSCKYyXxTPFAf:c:-:W:D:B:s:e:b:N:" | |||
while getopts "$optspec" o; do | while getopts "$optspec" o; do | |||
case $o in | case $o in | |||
-) | -) | |||
case $OPTARG in | case $OPTARG in | |||
help) | help) | |||
help | help | |||
exit 0 | exit 0 | |||
;; | ;; | |||
uninstall) | uninstall) | |||
exit 0 | exit 0 | |||
skipping to change at line 173 | skipping to change at line 178 | |||
;; | ;; | |||
no-exportbuild) | no-exportbuild) | |||
sblexports=0 | sblexports=0 | |||
;; | ;; | |||
exitFail) | exitFail) | |||
sexitFail=1 | sexitFail=1 | |||
;; | ;; | |||
no-tftpbuild) | no-tftpbuild) | |||
snoTftpBuild="true" | snoTftpBuild="true" | |||
;; | ;; | |||
no-pxedefault) | arm-support) | |||
snotpxedefaultfile="true" | sarmsupport=1 | |||
;; | ;; | |||
*) | *) | |||
if [[ $OPTERR == 1 && ${optspec:0:1} != : ]]; then | if [[ $OPTERR == 1 && ${optspec:0:1} != : ]]; then | |||
echo "Unknown option: --${OPTARG}" | echo "Unknown option: --${OPTARG}" | |||
help | help | |||
exit 7 | exit 7 | |||
fi | fi | |||
;; | ;; | |||
esac | esac | |||
;; | ;; | |||
skipping to change at line 287 | skipping to change at line 292 | |||
;; | ;; | |||
E) | E) | |||
sblexports=0 | sblexports=0 | |||
;; | ;; | |||
X) | X) | |||
exitFail=1 | exitFail=1 | |||
;; | ;; | |||
T) | T) | |||
snoTftpBuild="true" | snoTftpBuild="true" | |||
;; | ;; | |||
P) | A) | |||
snotpxedefaultfile="true" | sarmsupport=1 | |||
;; | ||||
N) | ||||
if [[ -z $OPTARG ]]; then | ||||
echo "Please specify a database name" | ||||
help | ||||
exit 4 | ||||
fi | ||||
smysqldbname=$OPTARG | ||||
;; | ;; | |||
:) | :) | |||
echo "Option -$OPTARG requires a value" | echo "Option -$OPTARG requires a value" | |||
help | help | |||
exit 8 | exit 8 | |||
;; | ;; | |||
*) | *) | |||
if [[ $OPTERR == 1 && ${optspec:0:1} != : ]]; then | if [[ $OPTERR == 1 && ${optspec:0:1} != : ]]; then | |||
echo "Unknown option: -$OPTARG" | echo "Unknown option: -$OPTARG" | |||
help | help | |||
skipping to change at line 371 | skipping to change at line 384 | |||
[[ -z $hostname ]] && hostname="" | [[ -z $hostname ]] && hostname="" | |||
[[ -z $routeraddress ]] && routeraddress="" | [[ -z $routeraddress ]] && routeraddress="" | |||
[[ -z $plainrouter ]] && plainrouter="" | [[ -z $plainrouter ]] && plainrouter="" | |||
[[ -z $blexports ]] && blexports=1 | [[ -z $blexports ]] && blexports=1 | |||
[[ -z $installlang ]] && installlang=0 | [[ -z $installlang ]] && installlang=0 | |||
[[ -z $bluseralreadyexists ]] && bluseralreadyexists=0 | [[ -z $bluseralreadyexists ]] && bluseralreadyexists=0 | |||
[[ -z $guessdefaults ]] && guessdefaults=1 | [[ -z $guessdefaults ]] && guessdefaults=1 | |||
[[ -z $doupdate ]] && doupdate=1 | [[ -z $doupdate ]] && doupdate=1 | |||
[[ -z $ignorehtmldoc ]] && ignorehtmldoc=0 | [[ -z $ignorehtmldoc ]] && ignorehtmldoc=0 | |||
[[ -z $httpproto ]] && httpproto="http" | [[ -z $httpproto ]] && httpproto="http" | |||
[[ -z $armsupport ]] && armsupport=0 | ||||
[[ -z $mysqldbname ]] && mysqldbname="fog" | ||||
[[ -z $fogpriorconfig ]] && fogpriorconfig="$fogprogramdir/.fogsettings" | [[ -z $fogpriorconfig ]] && fogpriorconfig="$fogprogramdir/.fogsettings" | |||
#clearScreen | #clearScreen | |||
if [[ -z $* || $* != +(-h|-?|--help|--uninstall) ]]; then | if [[ -z $* || $* != +(-h|-?|--help|--uninstall) ]]; then | |||
echo > "$workingdir/error_logs/foginstall.log" | echo > "$workingdir/error_logs/foginstall.log" | |||
exec &> >(tee -a "$workingdir/error_logs/foginstall.log") | exec &> >(tee -a "$workingdir/error_logs/foginstall.log") | |||
fi | fi | |||
displayBanner | displayBanner | |||
echo -e " Version: $version Installer/Updater\n" | echo -e " Version: $version Installer/Updater\n" | |||
checkSELinux | checkSELinux | |||
checkFirewall | checkFirewall | |||
case $doupdate in | case $doupdate in | |||
1) | 1) | |||
if [[ -f $fogpriorconfig ]]; then | if [[ -f $fogpriorconfig ]]; then | |||
echo -e "\n * Found FOG Settings from previous install at: $fogprogr amdir/.fogsettings\n" | echo -e "\n * Found FOG Settings from previous install at: $fogprogr amdir/.fogsettings\n" | |||
echo -n " * Performing upgrade using these settings" | echo -n " * Performing upgrade using these settings" | |||
. "$fogpriorconfig" | . "$fogpriorconfig" | |||
doOSSpecificIncludes | doOSSpecificIncludes | |||
[[ -n $sblexports ]] && blexports=$sblexports | [[ -n $sblexports ]] && blexports=$sblexports | |||
[[ -n $snotpxedefaultfile ]] && notpxedefaultfile=$snotpxedefaultfil e | ||||
[[ -n $snoTftpBuild ]] && noTftpBuild=$snoTftpBuild | [[ -n $snoTftpBuild ]] && noTftpBuild=$snoTftpBuild | |||
[[ -n $sbootfilename ]] && bootfilename=$sbootfilename | [[ -n $sbootfilename ]] && bootfilename=$sbootfilename | |||
[[ -n $sbackupPath ]] && backupPath=$sbackupPath | [[ -n $sbackupPath ]] && backupPath=$sbackupPath | |||
[[ -n $swebroot ]] && webroot=$swebroot | [[ -n $swebroot ]] && webroot=$swebroot | |||
[[ -n $sdocroot ]] && docroot=$sdocroot | [[ -n $sdocroot ]] && docroot=$sdocroot | |||
[[ -n $signorehtmldoc ]] && ignorehtmldoc=$signorehtmldoc | [[ -n $signorehtmldoc ]] && ignorehtmldoc=$signorehtmldoc | |||
[[ -n $scopybackold ]] && copybackold=$scopybackold | [[ -n $scopybackold ]] && copybackold=$scopybackold | |||
fi | fi | |||
;; | ;; | |||
*) | *) | |||
echo -e "\n * FOG Installer will NOT attempt to upgrade from\n previo us version of FOG." | echo -e "\n * FOG Installer will NOT attempt to upgrade from\n previo us version of FOG." | |||
;; | ;; | |||
esac | esac | |||
# evaluation of command line options | # evaluation of command line options | |||
[[ -n $shttpproto ]] && httpproto=$shttpproto | [[ -n $shttpproto ]] && httpproto=$shttpproto | |||
[[ -n $sstartrange ]] && startrange=$sstartrange | [[ -n $sstartrange ]] && startrange=$sstartrange | |||
[[ -n $sendrange ]] && endrange=$sendrange | [[ -n $sendrange ]] && endrange=$sendrange | |||
[[ -n $ssslpath ]] && sslpath=$ssslpath | [[ -n $ssslpath ]] && sslpath=$ssslpath | |||
[[ -n $srecreateCA ]] && recreateCA=$srecreateCA | [[ -n $srecreateCA ]] && recreateCA=$srecreateCA | |||
[[ -n $srecreateKeys ]] && recreateKeys=$srecreateKeys | [[ -n $srecreateKeys ]] && recreateKeys=$srecreateKeys | |||
[[ -n $sarmsupport ]] && armsupport=$sarmsupport | ||||
[[ -f $fogpriorconfig ]] && grep -l webroot $fogpriorconfig >>$workingdir/error_ logs/fog_error_${version}.log 2>&1 | [[ -f $fogpriorconfig ]] && grep -l webroot $fogpriorconfig >>$workingdir/error_ logs/fog_error_${version}.log 2>&1 | |||
case $? in | case $? in | |||
0) | 0) | |||
if [[ -n $webroot ]]; then | if [[ -n $webroot ]]; then | |||
webroot=${webroot#'/'} | webroot=${webroot#'/'} | |||
webroot=${webroot%'/'} | webroot=${webroot%'/'} | |||
[[ -z $webroot ]] && webroot="/" || webroot="/${webroot}/" | [[ -z $webroot ]] && webroot="/" || webroot="/${webroot}/" | |||
fi | fi | |||
;; | ;; | |||
skipping to change at line 431 | skipping to change at line 446 | |||
[[ -z $webroot ]] && webroot="/fog/" | [[ -z $webroot ]] && webroot="/fog/" | |||
;; | ;; | |||
esac | esac | |||
if [[ -z $backupPath ]]; then | if [[ -z $backupPath ]]; then | |||
backupPath="/home/" | backupPath="/home/" | |||
backupPath="${backupPath%'/'}" | backupPath="${backupPath%'/'}" | |||
backupPath="${backupPath#'/'}" | backupPath="${backupPath#'/'}" | |||
backupPath="/$backupPath/" | backupPath="/$backupPath/" | |||
fi | fi | |||
[[ -z $bootfilename ]] && bootfilename="undionly.kpxe" | [[ -z $bootfilename ]] && bootfilename="undionly.kpxe" | |||
[[ -n $smysqldbname ]] && mysqldbname=$smysqldbname | ||||
[[ ! $doupdate -eq 1 || ! $fogupdateloaded -eq 1 ]] && . ../lib/common/input.sh | [[ ! $doupdate -eq 1 || ! $fogupdateloaded -eq 1 ]] && . ../lib/common/input.sh | |||
# ask user input for newly added options like hostname etc. | # ask user input for newly added options like hostname etc. | |||
. ../lib/common/newinput.sh | . ../lib/common/newinput.sh | |||
echo | echo | |||
echo " ######################################################################" | echo " ######################################################################" | |||
echo " # FOG now has everything it needs for this setup, but please #" | echo " # FOG now has everything it needs for this setup, but please #" | |||
echo " # understand that this script will overwrite any setting you may #" | echo " # understand that this script will overwrite any setting you may #" | |||
echo " # have setup for services like DHCP, apache, pxe, tftp, and NFS. #" | echo " # have setup for services like DHCP, apache, pxe, tftp, and NFS. #" | |||
echo " ######################################################################" | echo " ######################################################################" | |||
echo " # It is not recommended that you install this on a production system #" | echo " # It is not recommended that you install this on a production system #" | |||
skipping to change at line 551 | skipping to change at line 568 | |||
echo -n " * Please enter a valid directory for your storage location (/images) " | echo -n " * Please enter a valid directory for your storage location (/images) " | |||
read storageLocation | read storageLocation | |||
[[ -z $storageLocation ]] && storageLocation="/image s" | [[ -z $storageLocation ]] && storageLocation="/image s" | |||
done | done | |||
;; | ;; | |||
esac | esac | |||
fi | fi | |||
configureUsers | configureUsers | |||
case $installtype in | case $installtype in | |||
[Ss]) | [Ss]) | |||
checkDatabaseConnection | ||||
backupReports | backupReports | |||
configureMinHttpd | configureMinHttpd | |||
configureStorage | configureStorage | |||
configureDHCP | configureDHCP | |||
configureTFTPandPXE | configureTFTPandPXE | |||
configureFTP | configureFTP | |||
configureSnapins | configureSnapins | |||
configureUDPCast | configureUDPCast | |||
installInitScript | installInitScript | |||
installFOGServices | installFOGServices | |||
skipping to change at line 572 | skipping to change at line 590 | |||
configureNFS | configureNFS | |||
writeUpdateFile | writeUpdateFile | |||
linkOptFogDir | linkOptFogDir | |||
if [[ $bluseralreadyexists == 1 ]]; then | if [[ $bluseralreadyexists == 1 ]]; then | |||
echo | echo | |||
echo "\n * Upgrade complete\n" | echo "\n * Upgrade complete\n" | |||
echo | echo | |||
else | else | |||
registerStorageNode | registerStorageNode | |||
updateStorageNodeCredentials | updateStorageNodeCredentials | |||
[[ -n $snmysqlhost ]] && fogserver=$snmysqlhost || fogse rver="fog-server" | ||||
echo | echo | |||
echo " * Setup complete" | echo " * Setup complete" | |||
echo | echo | |||
echo | echo | |||
echo " * You still need to setup this node in the fog ma nagement " | echo " * You still need to setup this node in the fog ma nagement " | |||
echo " | portal. You will need the username and password listed" | echo " | portal. You will need the username and password listed" | |||
echo " | below." | echo " | below." | |||
echo | echo | |||
echo " * Management Server URL:" | echo " * Management Server URL:" | |||
echo " ${httpproto}://fog-server${webroot}" | echo " ${httpproto}://${fogserver}${webroot}" | |||
echo | echo | |||
echo " You will need this, write this down!" | echo " You will need this, write this down!" | |||
echo " Username: $username" | echo " IP Address: $ipaddress" | |||
echo " Password: $password" | echo " Interface: $interface" | |||
echo " Interface: $interface" | echo " Management Username: $username" | |||
echo " Address: $ipaddress" | echo " Management Password: $password" | |||
echo | echo | |||
fi | fi | |||
;; | ;; | |||
[Nn]) | [Nn]) | |||
configureMySql | configureMySql | |||
backupReports | backupReports | |||
configureHttpd | configureHttpd | |||
backupDB | backupDB | |||
updateDB | updateDB | |||
configureStorage | configureStorage | |||
End of changes. 15 change blocks. | ||||
15 lines changed or deleted | 35 lines changed or added |