From b8ce1ce9322e03e675647c6e098485cdb25e4ea3 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 9 May 2024 00:26:22 +0700 Subject: [PATCH] Add bash & bash completion --- docker/openvswitch/Dockerfile | 10 ++++++++-- docker/openvswitch/boot.sh | 16 ++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docker/openvswitch/Dockerfile b/docker/openvswitch/Dockerfile index 81672ec..27c915c 100644 --- a/docker/openvswitch/Dockerfile +++ b/docker/openvswitch/Dockerfile @@ -1,6 +1,12 @@ FROM alpine:latest -RUN apk add --update openvswitch nano && rm -rf /var/cache/apk/* +RUN apk add --no-cache --update openvswitch nano bash bash-completion + +# Make bash the default shell +RUN sed -i s,/bin/ash,/bin/bash, /etc/passwd + +# Enable bash completion +RUN echo -e "source /etc/profile.d/bash_completion.sh" >> ~/.bashrc RUN mkdir /var/run/openvswitch @@ -8,4 +14,4 @@ VOLUME /etc/openvswitch/ ADD boot.sh /bin/boot.sh -CMD /bin/sh /bin/boot.sh +CMD /bin/bash /bin/boot.sh diff --git a/docker/openvswitch/boot.sh b/docker/openvswitch/boot.sh index 3e359f3..b5ebd8a 100644 --- a/docker/openvswitch/boot.sh +++ b/docker/openvswitch/boot.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash # -# Copyright (C) 2015 GNS3 Technologies Inc. +# Copyright (C) 2024 GNS3 Technologies Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # along with this program. If not, see . -if [ ! -f "/etc/openvswitch/conf.db" ] +if [[ ! -f "/etc/openvswitch/conf.db" ]] then ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema @@ -25,20 +25,20 @@ then ovs-vsctl --no-wait init x=0 - until [ $x = "4" ]; do + until [[ $x = "4" ]]; do ovs-vsctl add-br br$x ovs-vsctl set bridge br$x datapath_type=netdev x=$((x+1)) done - if [ $MANAGEMENT_INTERFACE == 1 ] + if [[ $MANAGEMENT_INTERFACE == 1 ]] then x=1 else x=0 fi - until [ $x = "16" ]; do + until [[ $x = "16" ]]; do ovs-vsctl add-port br0 eth$x x=$((x+1)) done @@ -49,9 +49,9 @@ fi x=0 -until [ $x = "4" ]; do +until [[ $x = "4" ]]; do ip link set dev br$x up x=$((x+1)) done -/bin/sh +/bin/bash