diff --git a/scripts/build-images b/scripts/build-images index 478256a9..d305520d 100755 --- a/scripts/build-images +++ b/scripts/build-images @@ -21,7 +21,7 @@ for i in $BASE/[0-9]*; do if dapper -d --build -f ${i}/Dockerfile -- -t rancher/${name} ${i}; then docker tag rancher/${name} ${tag} - echo "${tag}" >> dist/images + echo "${tag}" >> dist/images elif [ "$?" != "42" ]; then exit 1 else diff --git a/scripts/hosting/digitalocean/host.sh b/scripts/hosting/digitalocean/host.sh index 11ffed1e..ab3eb8b7 100755 --- a/scripts/hosting/digitalocean/host.sh +++ b/scripts/hosting/digitalocean/host.sh @@ -15,12 +15,12 @@ DIST="../../../dist/artifacts" command -v caddy >/dev/null 2>&1 || { echo >&2 "I require caddy but it's not installed, see https://github.com/mholt/caddy#quick-start . Aborting."; exit 1; } if [[ -e "dist/artifacts" ]]; then - cd scripts/hosting/digitalocean + cd scripts/hosting/digitalocean fi if [[ ! -e "$DIST" ]]; then - echo "Need to 'make release' so that there are files to serve. Aborting." - exit 1 + echo "Need to 'make release' so that there are files to serve. Aborting." + exit 1 fi source ${DIST}/../../scripts/version @@ -35,10 +35,10 @@ SOURCECONFIG="fedora-symbiote.yml" CLOUDCONFIG="digitalocean.sh" cat ${SOURCECONFIG} \ - | sed "s|^URL_BASE.*$|URL_BASE=http://${IP}:${PORT}|g" \ - | sed "s|^VMLINUX.*$|VMLINUX=${VMLINUX}|g" \ - | sed "s|^INITRD.*$|INITRD=${INITRD}|g" \ - > ${DIST}/${CLOUDCONFIG} + | sed "s|^URL_BASE.*$|URL_BASE=http://${IP}:${PORT}|g" \ + | sed "s|^VMLINUX.*$|VMLINUX=${VMLINUX}|g" \ + | sed "s|^INITRD.*$|INITRD=${INITRD}|g" \ + > ${DIST}/${CLOUDCONFIG} echo "Hosting a cloud-config script at http://${IP}:${PORT}/${CLOUDCONFIG}" echo "Usage:" diff --git a/scripts/hosting/packet/test.expect b/scripts/hosting/packet/test.expect index 04beb960..770f75cc 100755 --- a/scripts/hosting/packet/test.expect +++ b/scripts/hosting/packet/test.expect @@ -15,29 +15,29 @@ append command [lrange $argv 4 end] set timeout -1 proc runcmd { username password cmd } { - send_user "<< username: $username" - send_user "<< password: $password" - send_user "<< cmd: $cmd" + send_user "<< username: $username" + send_user "<< password: $password" + send_user "<< cmd: $cmd" - set done 0; - while {$done == 0} { - expect { - "*?login:" { - send -- "$username\r" - } - "*?assword:" { - send -- "$password\r" - #send -- "\r" - } - "*?:~#" { - send -- "$cmd\r" - set done 1 - } - "*?Reached target Shutdown." { - set done 1 - } - } - } + set done 0; + while {$done == 0} { + expect { + "*?login:" { + send -- "$username\r" + } + "*?assword:" { + send -- "$password\r" + #send -- "\r" + } + "*?:~#" { + send -- "$cmd\r" + set done 1 + } + "*?Reached target Shutdown." { + set done 1 + } + } + } } @@ -48,16 +48,16 @@ send -- "\r" set running [ runcmd $username $password $command ] expect { - "*? (yes/no)?" { - send -- "no\r" - expect "# " - } - "# " { - } - "*?Restarting system" { - } - "*?kexec_core: Starting new kernel" { - } + "*? (yes/no)?" { + send -- "no\r" + expect "# " + } + "# " { + } + "*?Restarting system" { + } + "*?kexec_core: Starting new kernel" { + } } send_user "<< DONE expect" diff --git a/scripts/hosting/packet/test.sh b/scripts/hosting/packet/test.sh index 50713cfe..9a2c7ae1 100755 --- a/scripts/hosting/packet/test.sh +++ b/scripts/hosting/packet/test.sh @@ -8,12 +8,12 @@ set -ex # https://github.com/packethost/docker-machine-driver-packet/releases if [ "${PACKET_API_KEY}" == "" ]; then - echo "need to set the PACKET_API_KEY" - exit + echo "need to set the PACKET_API_KEY" + exit fi if [ "${PACKET_PROJECT_ID}" == "" ]; then - echo "need to set the PACKET_PROJECT_ID" - exit + echo "need to set the PACKET_PROJECT_ID" + exit fi # facilities @@ -31,12 +31,12 @@ PLAN=baremetal_0 HOST=sven-${FACILITY}-${PLAN/_/-} if ! docker-machine inspect $HOST ; then - docker-machine create -d packet \ - --packet-api-key=${PACKET_API_KEY} --packet-project-id=${PACKET_PROJECT_ID} \ - --packet-facility-code ${FACILITY} \ - --packet-plan ${PLAN} \ - --packet-os=ubuntu_16_04 \ - ${HOST} + docker-machine create -d packet \ + --packet-api-key=${PACKET_API_KEY} --packet-project-id=${PACKET_PROJECT_ID} \ + --packet-facility-code ${FACILITY} \ + --packet-plan ${PLAN} \ + --packet-os=ubuntu_16_04 \ + ${HOST} fi SSH="docker-machine ssh $HOST" @@ -116,7 +116,7 @@ $SSHSOS sudo dd if=/dev/zero of=/dev/sda count=4 bs=1024 #If you're not running a type-0, also run the following command: if [ "$PLAN" != "baremetal_0" ]; then - $SSHSOS sudo dd if=/dev/zero of=/dev/sdb count=4 bs=1024 + $SSHSOS sudo dd if=/dev/zero of=/dev/sdb count=4 bs=1024 fi #Both of these will hang after you run them. Just let them run for a second or two and then hit ctrl+c. diff --git a/scripts/installer/lay-down-os b/scripts/installer/lay-down-os index 40ef566c..c1e9166b 100755 --- a/scripts/installer/lay-down-os +++ b/scripts/installer/lay-down-os @@ -16,7 +16,7 @@ do c) CLOUD_CONFIG="$OPTARG" ;; a) APPEND="$OPTARG" ;; g) MBR_FILE=gptmbr.bin ;; - # upgrade! + # upgrade! r) ROLLBACK_VERSION="$OPTARG" ;; k) KEXEC=y ;; # used for testing? diff --git a/scripts/installer/set-disk-partitions b/scripts/installer/set-disk-partitions index 75b2af32..0ad2cd8c 100755 --- a/scripts/installer/set-disk-partitions +++ b/scripts/installer/set-disk-partitions @@ -6,7 +6,7 @@ set -x DEVICE=${1} DISKTYPE=${2} if [[ -z $DISKTYPE ]]; then - DISKTYPE="msdos" + DISKTYPE="msdos" fi if [[ -z $DEVICE ]]; then @@ -18,14 +18,14 @@ PARTITION_COUNT=$(grep $(echo $DEVICE | cut -d '/' -f3) /proc/partitions | wc -l if [ "$PARTITION_COUNT" -gt "1" ]; then echo "Device ${DEVICE} already partitioned!" echo "Checking to see if it is mounted" - + # Check this container first... if grep -q "${DEVICE}" /proc/mounts; then echo "Device is mounted, we can not repartition" 1>&2 exit 1 fi - - # Check other system containers... + + # Check other system containers... for container in $(system-docker ps -q); do if system-docker exec $container grep -q "${DEVICE}" /proc/mounts; then echo "Device is mounted in system container ${container}, we can not repartition" 1>&2 diff --git a/scripts/integration-test b/scripts/integration-test index 2191e46a..46de01a2 100755 --- a/scripts/integration-test +++ b/scripts/integration-test @@ -15,7 +15,7 @@ if [ ! -e "../dist/artifacts/$INITRD" ]; then fi if [ "$RUNTEST" != "" ]; then - RUNTEST="-check.f ${RUNTEST}" + RUNTEST="-check.f ${RUNTEST}" fi time go test -v -timeout 9999m $RUNTEST diff --git a/scripts/layout-kernel b/scripts/layout-kernel index fc5ef04b..318396ab 100755 --- a/scripts/layout-kernel +++ b/scripts/layout-kernel @@ -39,7 +39,7 @@ if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then ## and then package it up cpio #cd ${BUILD}/kernel-fs/ #echo Creating kernel ${ARTIFACTS}/linuxmods-${KERNEL_VERSION} - + #if [ "$COMPRESS" == "" ]; then # COMPRESS="gzip -1" #fi @@ -50,17 +50,17 @@ if [ -e ${DOWNLOADS}/kernel.tar.gz ]; then #cp ${ARTIFACTS}/linuxmods-${KERNEL_VERSION} ${BUILD}/kernel/linuxmods fi else - if [ "$ARCH" == "amd64" ]; then - echo "no ${DOWNLOADS}/kernel.tar.gz found" - exit 1 - fi + if [ "$ARCH" == "amd64" ]; then + echo "no ${DOWNLOADS}/kernel.tar.gz found" + exit 1 + fi fi if [ "$ARCH" == "amd64" ]; then - ls -lah ${ARTIFACTS}/vmlinuz-* - if [ ! -e "${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}" ]; then - echo "Can't find ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}" - exit -1 - fi + ls -lah ${ARTIFACTS}/vmlinuz-* + if [ ! -e "${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}" ]; then + echo "Can't find ${ARTIFACTS}/vmlinuz-${KERNEL_VERSION}" + exit -1 + fi fi diff --git a/scripts/ros b/scripts/ros index 086261cf..640096f7 100755 --- a/scripts/ros +++ b/scripts/ros @@ -4,10 +4,10 @@ set -e cd $(dirname $0)/.. if [ ! -e "./build/initrd/usr/share/ros/os-config.yml" ]; then - ./.dapper release + ./.dapper release else - echo "using existing build of ros" -# ./.dapper build-target + echo "using existing build of ros" + #./.dapper build-target fi source ./scripts/version @@ -20,10 +20,10 @@ echo "cloud-init-save" echo "---------------------------------" docker run --rm -it \ - -v $(pwd)/build/initrd/usr/share:/usr/share \ - -v $(pwd)/bin/ros:/usr/bin/ros \ - -v /etc/ssl/certs:/etc/ssl/certs \ - -v /usr/share/ca-certificates:/usr/share/ca-certificates \ - -w /var/lib/rancher \ - --entrypoint sh \ - rancher/os-base:v1.0.3 + -v $(pwd)/build/initrd/usr/share:/usr/share \ + -v $(pwd)/bin/ros:/usr/bin/ros \ + -v /etc/ssl/certs:/etc/ssl/certs \ + -v /usr/share/ca-certificates:/usr/share/ca-certificates \ + -w /var/lib/rancher \ + --entrypoint sh \ + rancher/os-base:v1.0.3 diff --git a/scripts/run b/scripts/run index 0bf0eebf..b6f57c46 100755 --- a/scripts/run +++ b/scripts/run @@ -10,8 +10,8 @@ MEMORY=2048 while [ "$#" -gt 0 ]; do case $1 in - --debug) - DEBUG=1 + --debug) + DEBUG=1 ;; --iso) BOOT_ISO=1 @@ -61,9 +61,9 @@ while [ "$#" -gt 0 ]; do shift 1 QEMU_APPEND="${QEMU_APPEND} $1" ;; - --rsyslog) - RSYSLOG=1 - ;; + --rsyslog) + RSYSLOG=1 + ;; --append-init) shift 1 APPEND_INIT="${APPEND_INIT} $1" @@ -187,9 +187,9 @@ if [ "$BOOT_PXE" == "1" ]; then return 0 fi if [ "$RSYSLOG" == "1" ]; then - defaultDev=$(ip route | grep default | cut -f 5 -d " ") - devIP=$(ip a show dev $defaultDev | grep "inet " | cut -d " " -f 6 | cut -d / -f 1) - KERNEL_ARGS="${KERNEL_ARGS} loglevel=8 netconsole=+9999@10.0.2.14/,514@${devIP}/" + defaultDev=$(ip route | grep default | cut -f 5 -d " ") + devIP=$(ip a show dev $defaultDev | grep "inet " | cut -d " " -f 6 | cut -d / -f 1) + KERNEL_ARGS="${KERNEL_ARGS} loglevel=8 netconsole=+9999@10.0.2.14/,514@${devIP}/" fi # ELIDE_COMMANDLINE - MUST BE LAST if [ "$APPEND_INIT" != "" ]; then @@ -287,16 +287,16 @@ if [ "$QIND" != "1" ]; then fi if [ "$GUICONSOLE" == "" ]; then - # default serial console - DISPLAY_OPTS="-nographic -serial mon:stdio -display none" - if [ "$CONSOLEDISPLAY" == "1" ]; then - DISPLAY_OPTS="-curses" - fi - if [ "$NETCONSOLE" == "1" ]; then - # put ttyS1 on port 4444 - DISPLAY_OPTS="${DISPLAY_OPTS} -serial tcp::4444,server" - KERNEL_ARGS="rancher.console=ttyS1 rancher.autologin=ttyS1 ${KERNEL_ARGS}" - fi + # default serial console + DISPLAY_OPTS="-nographic -serial mon:stdio -display none" + if [ "$CONSOLEDISPLAY" == "1" ]; then + DISPLAY_OPTS="-curses" + fi + if [ "$NETCONSOLE" == "1" ]; then + # put ttyS1 on port 4444 + DISPLAY_OPTS="${DISPLAY_OPTS} -serial tcp::4444,server" + KERNEL_ARGS="rancher.console=ttyS1 rancher.autologin=ttyS1 ${KERNEL_ARGS}" + fi fi if [ "${NO_NETWORK}" == "1" ]; then diff --git a/scripts/run-common b/scripts/run-common index 8cf63336..cce09fde 100755 --- a/scripts/run-common +++ b/scripts/run-common @@ -49,7 +49,7 @@ QEMUARCH=${qemuarch["${ARCH}"]} TTYCONS=${ttycons["${ARCH}"]} if [ "$ENGINE_REGISTRY_MIRROR" != "" ]; then - REGISTRY_MIRROR="rancher.bootstrap_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.system_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.docker.registry_mirror=${ENGINE_REGISTRY_MIRROR}" + REGISTRY_MIRROR="rancher.bootstrap_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.system_docker.registry_mirror=${ENGINE_REGISTRY_MIRROR} rancher.docker.registry_mirror=${ENGINE_REGISTRY_MIRROR}" fi DEFAULT_KERNEL_ARGS="printk.devkmsg=on rancher.password=rancher console=tty1 rancher.autologin=tty1 console=${TTYCONS} rancher.autologin=${TTYCONS} ${REGISTRY_MIRROR} " diff --git a/scripts/run-install b/scripts/run-install index 2b6771d6..14e05e26 100755 --- a/scripts/run-install +++ b/scripts/run-install @@ -49,16 +49,16 @@ docker run --privileged -it --rm \ -v /dev/mapper:/dev/mapper \ -v ${STATE}:/cluster \ rancher/os:${VERSION} \ - --isoinstallerloaded=1 \ - --force \ - --no-reboot \ - --debug \ - -c /cluster/cloud-config.yml \ - -t generic \ - -d ${LOOPBACK} \ - -p ${PARTITION} \ - --append "rancher.autologin=tty1" - #-f /cluster/images.tar.xz:var/lib/system-docker/preload/images.tar.xz + --isoinstallerloaded=1 \ + --force \ + --no-reboot \ + --debug \ + -c /cluster/cloud-config.yml \ + -t generic \ + -d ${LOOPBACK} \ + -p ${PARTITION} \ + --append "rancher.autologin=tty1" + #-f /cluster/images.tar.xz:var/lib/system-docker/preload/images.tar.xz sync diff --git a/scripts/run-moby b/scripts/run-moby index d4ea5ed0..f7201d50 100755 --- a/scripts/run-moby +++ b/scripts/run-moby @@ -6,15 +6,15 @@ if [ "1" == "2" ]; then linuxkit run -mem 2048 rancheros else qemu-system-x86_64 \ - -nographic \ - -kernel ./rancheros-kernel \ - -initrd ./rancheros-initrd.img \ - -m 2048 \ - -device virtio-rng-pci \ - -smp 1 \ - -enable-kvm \ - -machine q35,accel=kvm:tcg \ - -net nic,vlan=0,model=virtio \ - -net user,vlan=0,hostfwd=tcp::3333-:22,hostname=rancher-moby \ - -append 'printk.devkmsg=on rancher.debug=true rancher.password=rancher console=ttyS0 rancher.autologin=ttyS0 console=tty0 rancher.autologin=tty0 console=tty1 rancher.autologin=tty1 rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/sda,/dev/vda] rancher.rm_usr' + -nographic \ + -kernel ./rancheros-kernel \ + -initrd ./rancheros-initrd.img \ + -m 2048 \ + -device virtio-rng-pci \ + -smp 1 \ + -enable-kvm \ + -machine q35,accel=kvm:tcg \ + -net nic,vlan=0,model=virtio \ + -net user,vlan=0,hostfwd=tcp::3333-:22,hostname=rancher-moby \ + -append 'printk.devkmsg=on rancher.debug=true rancher.password=rancher console=ttyS0 rancher.autologin=ttyS0 console=tty0 rancher.autologin=tty0 console=tty1 rancher.autologin=tty1 rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/sda,/dev/vda] rancher.rm_usr' fi