1
0
mirror of https://github.com/rancher/os.git synced 2025-09-16 06:59:12 +00:00

Optimize indentation format for shell scripts

This commit is contained in:
niusmallnan
2018-11-22 16:28:46 +08:00
parent b131ddeb7c
commit 50e72e629b
13 changed files with 117 additions and 117 deletions

View File

@@ -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

View File

@@ -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:"

View File

@@ -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"

View File

@@ -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.

View File

@@ -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?

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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} "

View File

@@ -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

View File

@@ -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