Skip to content

Commit

Permalink
fix: Closes issue #8 (read body)
Browse files Browse the repository at this point in the history
OVH and other providers remove the contents of /etc/issue in their
OS templates. So we need to ask the user manually to tell us what the
OS is as a Fallback.

In addition we removed the `OsSupported.php` Installer Policy because
its not really needed. We have already determined that the user has a
supported OS.
  • Loading branch information
poppabear8883 committed Aug 6, 2018
1 parent c19794b commit d97a114
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 22 deletions.
52 changes: 48 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,59 @@
#!/usr/bin/env bash

source tools/colors.sh

# Detect OS
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
Debian) type="debian" ;;
Ubuntu) type="ubuntu" ;;
*) type="rhel" ;;
*) type='' ;;
esac

# Fallback to Ubuntu
if [ ! -e "/etc/redhat-release" ]; then
type='ubuntu'
# Unable to detect OS Properly
# Note: OVH and other providers remove the contents of /etc/issue in their OS templates
# so we need to ask the user manually to tell us what the OS is as a Fallback
# Ref: https://github.com/ServNX/UNIT3D-INSTALLER/issues/8
if [ "$type" = '' ]; then
echo -e "\n$Red We was unable to automatically determine your OS! $Color_Off"
echo -e "\n$Purple This can happen if you are using an OS template from a provider like OVH amongst others. $Color_Off\n"

PS3='Please select the # for your OS: '
options=("Ubuntu 18.04" "Ubuntu 16.04" "Other Ubuntu" "Debian" "Other" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Ubuntu 18.04")
echo 'Ubuntu 18.04 LTS \n \l' > /etc/issue
type='ubuntu'
break
;;
"Ubuntu 16.04")
echo 'Ubuntu 16.04 LTS \n \l' > /etc/issue
type='ubuntu'
break
;;
"Other Ubuntu")
echo 'Ubuntu UNKNOWN LTS \n \l' > /etc/issue
type='ubuntu'
break
;;
"Debian")
echo 'Debian GNU/Linux \n \l' > /etc/issue
type='debian'
break
;;
"Other")
echo -e "$Red Unsupported GNU/Linux distribution $Color_Off"
exit 1
;;
"Quit")
exit 0
;;
*)
echo -e "$Red Invalid Option $REPLY $Color_Off"
;;
esac
done
fi

if [ -e $type.sh ]; then
Expand Down
5 changes: 0 additions & 5 deletions src/Installer/Policies/InstallerPolicies.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
class InstallerPolicies extends BasePolicy
{
private $steps = [
/*
* Os and Distribution Support policies
*/
OsSupported::class,

/*
* Configuration policies
*/
Expand Down
13 changes: 0 additions & 13 deletions src/Installer/Policies/OsSupported.php

This file was deleted.

0 comments on commit d97a114

Please sign in to comment.