1
0
mirror of https://github.com/rancher/os.git synced 2025-06-24 14:01:34 +00:00

Set defaults based off of RanchOS info

If running on RancherOS gather sane defaults for users.
This commit is contained in:
Bill Maxwell 2015-03-12 14:10:25 -07:00
parent 9ed1f075bb
commit bee6675b36

View File

@ -13,7 +13,7 @@ Options:
-d device -d device
-f [ DANGEROUS! Data loss can happen ] partition/format without prompting -f [ DANGEROUS! Data loss can happen ] partition/format without prompting
-t install-type: -t install-type:
generic: Creates 1 ext4 partition and installs RancherOS generic: (Default) Creates 1 ext4 partition and installs RancherOS
amazon-ebs: Installs RancherOS and sets up PV-GRUB amazon-ebs: Installs RancherOS and sets up PV-GRUB
-v os-installer version. -v os-installer version.
-h print this -h print this
@ -21,17 +21,24 @@ EOF
} }
PARTITION_FLAG="false" PARTITION_FLAG="false"
INSTALLER_VERSION="latest"
EXTRA_ARGS=
INSTALL_CONTAINER_IMAGE="rancher/os" INSTALL_CONTAINER_IMAGE="rancher/os"
if [ -x /usr/bin/rancherctl ]; then
INSTALL_CONTAINER_IMAGE="$(rancherctl config get upgrade.image)"
fi
if [ -n "$(grep RancherOS /etc/lsb-release)" ]; then
INSTALLER_VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release|cut -d'=' -f2)
fi
EXTRA_ARGS=
while getopts "c:d:ft:v:h" OPTION while getopts "c:d:ft:v:h" OPTION
do do
case $OPTION in case $OPTION in
c) CLOUD_CONFIG="$OPTARG" ;; c) CLOUD_CONFIG="$OPTARG" ;;
d) DEVICE="$OPTARG" ;; d) DEVICE="$OPTARG" ;;
f) FORCE_INSTALL="true" ;; f) FORCE_INSTALL="true" ;;
# p) PARTITION_FLAG="true" ;;
t) INSTALL_TYPE="${OPTARG}" ;; t) INSTALL_TYPE="${OPTARG}" ;;
v) INSTALLER_VERSION="$OPTARG" ;; v) INSTALLER_VERSION="$OPTARG" ;;
h) usage; exit ;; h) usage; exit ;;
@ -45,8 +52,8 @@ if [ "$(whoami)" != "root" ]; then
fi fi
if [[ -z "${INSTALL_TYPE}" ]]; then if [[ -z "${INSTALL_TYPE}" ]]; then
echo "$0: No install type specified, -t required to install" 1>&2 echo "No install type specified...defaulting to generic"
exit 1 INSTALL_TYPE="generic"
fi fi
if [ -z "${CLOUD_CONFIG}" ] && [ "${INSTALL_TYPE}" != "amazon-ebs" ]; then if [ -z "${CLOUD_CONFIG}" ] && [ "${INSTALL_TYPE}" != "amazon-ebs" ]; then
@ -54,6 +61,11 @@ if [ -z "${CLOUD_CONFIG}" ] && [ "${INSTALL_TYPE}" != "amazon-ebs" ]; then
exit 1 exit 1
fi fi
if [[ -z "${DEVICE}" ]]; then
echo "$0: No device defined. Can not proceed without -d <dev> specified" 1>&2
exit 1
fi
if [ "${INSTALL_TYPE}" == "generic" ]; then if [ "${INSTALL_TYPE}" == "generic" ]; then
PARTITION_FLAG="true" PARTITION_FLAG="true"
fi fi