From 54f7a4d6959cce72cbefa83ada6becc63882beb8 Mon Sep 17 00:00:00 2001 From: Zack Brady Date: Tue, 5 Nov 2024 01:05:11 -0500 Subject: [PATCH] updated variables based on feedback --- cmd/hauler/cli/cli.go | 2 +- cmd/hauler/cli/store/load.go | 2 +- install.sh | 18 +++++++++--------- pkg/cosign/cosign.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/hauler/cli/cli.go b/cmd/hauler/cli/cli.go index 17bb49b..2dea1c0 100644 --- a/cmd/hauler/cli/cli.go +++ b/cmd/hauler/cli/cli.go @@ -13,7 +13,7 @@ func New() *cobra.Command { cmd := &cobra.Command{ Use: "hauler", Short: "Airgap Swiss Army Knife", - Example: " View the Docs: https://docs.hauler.dev\n Environment Variables: HAULER_DIR | HAULER_TEMP_DIR", + Example: " View the Docs: https://docs.hauler.dev\n Environment Variables: HAULER_HOME | HAULER_TEMP", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { l := log.FromContext(cmd.Context()) l.SetLevel(ro.LogLevel) diff --git a/cmd/hauler/cli/store/load.go b/cmd/hauler/cli/store/load.go index ed68ae2..aa3ad98 100644 --- a/cmd/hauler/cli/store/load.go +++ b/cmd/hauler/cli/store/load.go @@ -31,7 +31,7 @@ func LoadCmd(ctx context.Context, o *flags.LoadOpts, archiveRefs ...string) erro // unarchiveLayoutTo accepts an archived oci layout and extracts the contents to an existing oci layout, preserving the index func unarchiveLayoutTo(ctx context.Context, archivePath string, dest string, tempOverride string) error { if tempOverride == "" { - tempOverride = os.Getenv("HAULER_TEMP_DIR") + tempOverride = os.Getenv("HAULER_TEMP") } tempDir, err := os.MkdirTemp(tempOverride, "hauler") diff --git a/install.sh b/install.sh index f762fed..1a22aa7 100755 --- a/install.sh +++ b/install.sh @@ -18,8 +18,8 @@ # - HAULER_INSTALL_DIR=/usr/local/bin ./install.sh # # Set Hauler Directory -# - curl -sfL https://get.hauler.dev | HAULER_DIR=$HOME/.hauler bash -# - HAULER_DIR=$HOME/.hauler ./install.sh +# - curl -sfL https://get.hauler.dev | HAULER_HOME=$HOME/.hauler bash +# - HAULER_HOME=$HOME/.hauler ./install.sh # # Debug Usage: # - curl -sfL https://get.hauler.dev | HAULER_DEBUG=true bash @@ -87,7 +87,7 @@ if [ "${HAULER_UNINSTALL}" = "true" ]; then rm -rf "${HAULER_INSTALL_DIR}/hauler" || fatal "Failed to Remove Hauler from ${HAULER_INSTALL_DIR}" # remove the hauler directory - rm -rf "${HAULER_DIR}" || fatal "Failed to Remove Hauler Directory: ${HAULER_DIR}" + rm -rf "${HAULER_HOME}" || fatal "Failed to Remove Hauler Directory: ${HAULER_HOME}" info "Successfully Uninstalled Hauler" && echo exit 0 @@ -133,7 +133,7 @@ case $ARCH in esac # set hauler directory from argument or environment variable -HAULER_DIR=${HAULER_DIR:-$HOME/.hauler} +HAULER_HOME=${HAULER_HOME:-$HOME/.hauler} # start hauler installation info "Starting Installation..." @@ -143,18 +143,18 @@ verbose "- Version: v${HAULER_VERSION}" verbose "- Platform: ${PLATFORM}" verbose "- Architecture: ${ARCH}" verbose "- Install Directory: ${HAULER_INSTALL_DIR}" -verbose "- Hauler Directory: ${HAULER_DIR}" +verbose "- Hauler Directory: ${HAULER_HOME}" # ensure hauler directory exists and/or create it -if [ ! -d "${HAULER_DIR}" ]; then - mkdir -p "${HAULER_DIR}" || fatal "Failed to Create Hauler Directory: ${HAULER_DIR}" +if [ ! -d "${HAULER_HOME}" ]; then + mkdir -p "${HAULER_HOME}" || fatal "Failed to Create Hauler Directory: ${HAULER_HOME}" fi # ensure hauler directory is writable (by user or root privileges) -chmod -R 777 "${HAULER_DIR}" || fatal "Failed to Update Permissions of Hauler Directory: ${HAULER_DIR}" +chmod -R 777 "${HAULER_HOME}" || fatal "Failed to Update Permissions of Hauler Directory: ${HAULER_HOME}" # change to hauler directory -cd "${HAULER_DIR}" || fatal "Failed to Change Directory to Hauler Directory: ${HAULER_DIR}" +cd "${HAULER_HOME}" || fatal "Failed to Change Directory to Hauler Directory: ${HAULER_HOME}" # start hauler artifacts download info "Starting Download..." diff --git a/pkg/cosign/cosign.go b/pkg/cosign/cosign.go index cc3c80c..e8f9554 100644 --- a/pkg/cosign/cosign.go +++ b/pkg/cosign/cosign.go @@ -256,7 +256,7 @@ func getCosignPath() (string, error) { homeDir := currentUser.HomeDir // Construct the path to the .hauler directory - haulerDir := os.Getenv("HAULER_DIR") + haulerDir := os.Getenv("HAULER_HOME") if haulerDir == "" { haulerDir = filepath.Join(homeDir, ".hauler") }