1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Convert install script to go

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2016-12-01 13:55:19 +10:00
parent 80820e610a
commit 087bc6fd2d
15 changed files with 797 additions and 29 deletions

4
scripts/installer/Dockerfile.amd64 Normal file → Executable file
View File

@@ -5,9 +5,9 @@ RUN apt-get update && \
rm -rf /var/lib/apt/*
COPY ./build/vmlinuz ./build/initrd /dist/
COPY conf lay-down-os seed-data set-disk-partitions /scripts/
COPY conf ./build/ros /scripts/
ARG VERSION
ENV VERSION=${VERSION}
ENTRYPOINT ["/scripts/lay-down-os"]
ENTRYPOINT ["/scripts/ros"]

View File

@@ -10,17 +10,20 @@ MBR_FILE=mbr.bin
while getopts "i:f:c:d:t:r:o:p:ka:g" OPTION
do
case ${OPTION} in
i) DIST="$OPTARG" ;;
f) FILES="$OPTARG" ;;
c) CLOUD_CONFIG="$OPTARG" ;;
# used by `ros install`
d) DEVICE="$OPTARG" ;;
o) OEM="$OPTARG" ;;
t) ENV="$OPTARG" ;; # install type
c) CLOUD_CONFIG="$OPTARG" ;;
a) APPEND="$OPTARG" ;;
g) MBR_FILE=gptmbr.bin ;;
# used for testing?
k) KEXEC=y ;;
p) PARTITION="$OPTARG" ;;
r) ROLLBACK_VERSION="$OPTARG" ;;
k) KEXEC=y ;;
a) APPEND="$OPTARG" ;;
t) ENV="$OPTARG" ;;
g) MBR_FILE=gptmbr.bin ;;
# notused?
i) DIST="$OPTARG" ;;
f) FILES="$OPTARG" ;;
o) OEM="$OPTARG" ;;
*) exit 1 ;;
esac
done

View File

@@ -7,7 +7,6 @@ if [ "$ROOTFS" != "0" ]; then
./package-rootfs
fi
./package-initrd
./package-installer
./package-iso
if [ "$INSTALLER" != "0" ]; then
./package-installer
fi

View File

@@ -13,6 +13,7 @@ fi
mkdir -p ./scripts/installer/build
cp ./dist/artifacts/{initrd,vmlinuz} ./scripts/installer/build
cp ./bin/ros ./scripts/installer/build
trap "rm -rf ./scripts/installer/build" EXIT
docker build -t ${OS_REPO}/os:${VERSION}${SUFFIX} --build-arg VERSION=${VERSION} -f $DOCKERFILE ./scripts/installer

View File

@@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -x
source $(dirname $0)/version
cd $(dirname $0)/..
@@ -10,6 +11,7 @@ ISO=${ARTIFACTS}/$(echo ${DISTRIB_ID} | tr '[:upper:]' '[:lower:]').iso
CHECKSUM=iso-checksums.txt
mkdir -p ${CD}/boot/isolinux
mkdir -p ${CD}/rancheros
if [ ! -f ${ARTIFACTS}/vmlinuz ] || [ ! -f ${ARTIFACTS}/initrd ]; then
exit 0
@@ -20,6 +22,10 @@ cp ${ARTIFACTS}/vmlinuz ${CD}/boot
cp scripts/isolinux.cfg ${CD}/boot/isolinux
cp /usr/lib/ISOLINUX/isolinux.bin ${CD}/boot/isolinux
cp /usr/lib/syslinux/modules/bios/ldlinux.c32 ${CD}/boot/isolinux
# add the installer image to the iso for non-network / dev/test
cp ${ARTIFACTS}/installer.tar ${CD}/rancheros
cp assets/bootinfoscript ${CD}/rancheros
gzip ${CD}/rancheros/installer.tar
cd ${CD} && xorriso \
-as mkisofs \
-l -J -R -V "${DISTRIB_ID}" \

View File

@@ -12,6 +12,7 @@ while [ "$#" -gt 0 ]; do
BOOT_ISO=1
QEMU=0
QIND=0
REBUILD=0
;;
--append)
shift 1
@@ -59,7 +60,6 @@ while [ "$#" -gt 0 ]; do
FRESH=1
;;
--installed)
./scripts/create-installed
INSTALLED=1
;;
*)
@@ -107,7 +107,11 @@ if [ "$QEMU" == "1" ] || [ "$BOOT_ISO" == "1" ]; then
if [ ! -e ${HD} ]; then
mkdir -p $(dirname ${HD})
qemu-img create -f qcow2 -o size=10G ${HD}
if [ ¨$INSTALLED¨ == ¨1¨ ]; then
./scripts/create-installed
else
qemu-img create -f qcow2 -o size=10G ${HD}
fi
fi
if [ "$SECOND_DRIVE" == "1" ]; then

View File

@@ -46,4 +46,4 @@ REBUILD=1
QEMUARCH=${qemuarch["${ARCH}"]}
TTYCONS=${ttycons["${ARCH}"]}
DEFAULT_KERNEL_ARGS="quiet rancher.password=rancher console=${TTYCONS} rancher.autologin=${TTYCONS}"
DEFAULT_KERNEL_ARGS="rancher.debug=true rancher.password=rancher console=${TTYCONS} rancher.autologin=${TTYCONS}"