Skip to content

Commit

Permalink
Make scripts in hack compatible with NixOS (gardener#6155)
Browse files Browse the repository at this point in the history
This should not make any difference on other OSes but improves
usability on NixOS by a lot.

Signed-off-by: Jens Schneider <schneider@23technologies.cloud>
  • Loading branch information
JensAc authored Jun 21, 2022
1 parent bf9dcf5 commit e770214
Show file tree
Hide file tree
Showing 32 changed files with 59 additions and 32 deletions.
2 changes: 1 addition & 1 deletion hack/check-apidiff.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/check-charts.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/check-generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/compare-k8s-controllers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!usr/bin/env bash
#
# Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/compare-k8s-feature-gates.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/format.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-controller-registration.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-imagename-constants.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/generate-parallel.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
4 changes: 3 additions & 1 deletion hack/get-build-ld-flags.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

PACKAGE_PATH="${1:-k8s.io/component-base}"
VERSION_PATH="${2:-$(dirname $0)/../VERSION}"
PROGRAM_NAME="${3:-Gardener}"
Expand Down
2 changes: 1 addition & 1 deletion hack/install-requirements.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/local-development/common/helpers
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/common/local-imagevector-overwrite
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

__tmp_imagevector_overwrite=""
mktemp_imagevector_overwrite() {
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
Expand Down
2 changes: 1 addition & 1 deletion hack/local-development/dev-setup
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/dev-setup-register-gardener
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers

IP_ROUTE=$(ip route get 1)
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-admission-controller
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers

kubeconfig="$KUBECONFIG"
Expand Down
3 changes: 2 additions & 1 deletion hack/local-development/start-apiserver
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
source $(dirname "${0}")/common/helpers

kubeconfig="$KUBECONFIG"
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-controller-manager
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers

kubeconfig="$KUBECONFIG"
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-extension-provider-local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers
REPO_ROOT=$(dirname "${0}")/../..
ETCD_BACKUP_DIR=$REPO_ROOT/dev/local-backupbuckets
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-gardenlet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers
source $(dirname "${0}")/common/local-imagevector-overwrite

Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-resource-manager
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers

mktemp_kubeconfig
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-scheduler
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers

kubeconfig="$KUBECONFIG"
Expand Down
4 changes: 3 additions & 1 deletion hack/local-development/start-seed-admission-controller
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

source $(dirname "${0}")/common/helpers

mktemp_kubeconfig
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/install-promtool.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
2 changes: 1 addition & 1 deletion hack/update-protobuf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand Down
5 changes: 4 additions & 1 deletion hack/usage/delete
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
set -u

RESOURCE="$1"
NAME="$2"
NAMESPACE=""
Expand Down
5 changes: 4 additions & 1 deletion hack/usage/shoot-operation
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -eu
#!usr/bin/env bash
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
Expand All @@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
set -u

NAME="$1"
NAMESPACE="${2:-$(id -u -n)}"
OPERATION="${3:-reconcile}"
Expand Down

0 comments on commit e770214

Please sign in to comment.