From c9bdfd58b03b1145cc288273ca871152a9ebb308 Mon Sep 17 00:00:00 2001 From: wangyueliang Date: Mon, 1 Apr 2024 20:26:31 +0800 Subject: [PATCH] Use prompts to modify to NestOS --- mantle/cmd/kola/devshell.go | 2 +- mantle/cmd/plume/cosa2stream.go | 2 +- mantle/util/distros.go | 5 +++++ src/cmd-build | 4 ++-- src/cmd-build-fast | 4 ++-- src/cmd-buildextend-metal | 4 ++-- src/cmd-clean | 4 ++-- src/cmd-fetch | 4 ++-- src/cmd-init | 4 ++-- src/cmd-offline-update | 4 ++-- src/cmd-prune | 2 +- src/cmd-shell | 2 +- src/coreos-assembler | 12 ++++++++---- 13 files changed, 31 insertions(+), 22 deletions(-) diff --git a/mantle/cmd/kola/devshell.go b/mantle/cmd/kola/devshell.go index 229db5c7..0fb1ab8d 100644 --- a/mantle/cmd/kola/devshell.go +++ b/mantle/cmd/kola/devshell.go @@ -39,7 +39,7 @@ import ( "golang.org/x/term" ) -const devshellHostname = "cosa-devsh" +const devshellHostname = "nosa-devsh" func stripControlCharacters(s string) string { s = strings.ToValidUTF8(s, "") diff --git a/mantle/cmd/plume/cosa2stream.go b/mantle/cmd/plume/cosa2stream.go index b43f2afd..1103cb3a 100644 --- a/mantle/cmd/plume/cosa2stream.go +++ b/mantle/cmd/plume/cosa2stream.go @@ -136,7 +136,7 @@ func runCosaBuildToStream(cmd *cobra.Command, args []string) error { cosaArgs = append(cosaArgs, "--url="+arg) cosaArgs = append(cosaArgs, "--stream-name="+archStreamName) cosaArgs = append(cosaArgs, "--output="+releaseTmpf.Name()) - c := exec.Command("cosa", cosaArgs...) + c := exec.Command("nosa", cosaArgs...) c.Stderr = os.Stderr if err := c.Run(); err != nil { return err diff --git a/mantle/util/distros.go b/mantle/util/distros.go index 85eda440..8ddf800f 100644 --- a/mantle/util/distros.go +++ b/mantle/util/distros.go @@ -29,6 +29,9 @@ func TargetDistroFromName(artifact string) string { if strings.HasPrefix(basename, "rhcos-") { return "rhcos" } + if strings.HasPrefix(basename, "nestos-") { + return "nestos" + } // For now, just assume fcos return "fcos" } @@ -42,6 +45,8 @@ func TargetDistro(build *builds.Build) (string, error) { return "rhcos", nil case "fedora-coreos": return "fcos", nil + case "nestos": + return "nestos", nil default: return "", fmt.Errorf("Unknown distribution: %s", build.Name) } diff --git a/src/cmd-build b/src/cmd-build index 43e74cac..32290683 100755 --- a/src/cmd-build +++ b/src/cmd-build @@ -7,8 +7,8 @@ dn=$(dirname "$0") print_help() { cat 1>&2 <<'EOF' -Usage: coreos-assembler build --help - coreos-assembler build [OPTIONS]... [TARGET]... +Usage: nestos-assembler build --help + nestos-assembler build [OPTIONS]... [TARGET]... Build OSTree and image base artifacts from previously fetched packages. Accepted TARGET arguments: diff --git a/src/cmd-build-fast b/src/cmd-build-fast index 8addc35f..f9f9b70d 100755 --- a/src/cmd-build-fast +++ b/src/cmd-build-fast @@ -19,7 +19,7 @@ dn=$(dirname "$0") print_help() { cat 1>&2 <<'EOF' -Usage: coreos-assembler build-fast [--undeploy] +Usage: nestos-assembler build-fast [--undeploy] EOF } @@ -64,7 +64,7 @@ if test -e .git; then # shellcheck disable=SC2016 fatal 'This command requires inheriting from a previous full OS build. Use e.g. `export COSA_DIR=/path/to/fcos` that has a previous -run of `cosa build`.' +run of `nosa build`.' fi projectdir=$(pwd) cd "${COSA_DIR}" diff --git a/src/cmd-buildextend-metal b/src/cmd-buildextend-metal index 6827ddc5..22911e80 100755 --- a/src/cmd-buildextend-metal +++ b/src/cmd-buildextend-metal @@ -17,8 +17,8 @@ esac print_help() { cat 1>&2 <&2 <<'EOF' -Usage: coreos-assembler clean --help - coreos-assembler clean [--all] +Usage: nestos-assembler clean --help + nestos-assembler clean [--all] Delete all build artifacts. Use --all to also clean the cache/ directory. EOF diff --git a/src/cmd-fetch b/src/cmd-fetch index 03ffa962..35ce0b7d 100755 --- a/src/cmd-fetch +++ b/src/cmd-fetch @@ -19,8 +19,8 @@ fi print_help() { cat 1>&2 <<'EOF' -Usage: coreos-assembler fetch --help - coreos-assembler fetch [--update-lockfile] [--write-lockfile-to=file] [--with-cosa-overrides] [--strict] +Usage: nestos-assembler fetch --help + nestos-assembler fetch [--update-lockfile] [--write-lockfile-to=file] [--with-cosa-overrides] [--strict] Fetch and import the latest packages. EOF diff --git a/src/cmd-init b/src/cmd-init index 117977b9..f53bdfd9 100755 --- a/src/cmd-init +++ b/src/cmd-init @@ -12,8 +12,8 @@ COMMIT="" print_help() { cat 1>&2 <<'EOF' -Usage: coreos-assembler init --help - coreos-assembler init [--force] [--branch BRANCH] +Usage: nestos-assembler init --help + nestos-assembler init [--force] [--branch BRANCH] [--commit COMMIT] GITCONFIG [SUBDIR] For example, you can use https://github.com/coreos/fedora-coreos-config diff --git a/src/cmd-offline-update b/src/cmd-offline-update index fc06faff..53963b2e 100755 --- a/src/cmd-offline-update +++ b/src/cmd-offline-update @@ -21,8 +21,8 @@ dn=$(dirname "$0") print_help() { cat 1>&2 < ... +# Usage: nestos-assembler ... # Currently this just wraps the two binaries we have today # under a global entrypoint with subcommands. @@ -53,7 +53,7 @@ nestos_unsupport_buildextend_commands="aliyun aws azure azurestack dasd digitalo nestos_unsupport_utility_commands="aws-replicate aliyun-replicate koji-upload generate-hashlist remote-prune sign" if [ -z "${cmd}" ]; then - echo Usage: "coreos-assembler CMD ..." + echo Usage: "nestos-assembler CMD ..." echo "Build commands:" for bin in ${build_commands}; do echo " ${bin}" @@ -75,14 +75,18 @@ if [ -z "${cmd}" ]; then for bin in ${other_commands}; do echo " ${bin}" done | sort + + echo -e "\nNotice:\n" + echo -e " For bug reports, please submit an issue at [nestos-assembler](https://gitee.com/openeuler/nestos-assembler)." + echo -e " This software is a fork of [coreos-assembler](https://github.com/coreos/coreos-assembler), licensed under the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).\n" exit 1 fi shift # Determine if the function is currently not supported by Nestos if [[ "${nestos_unsupport_advanced_build_commands}" =~ (^| )"${cmd}"($| ) ]] || \ -[[ "${nestos_unsupport_utility_commands}" =~ (^| )"${cmd}"($| ) ]] || \ -[[ "${cmd}" =~ ^buildextend-.* && "${nestos_unsupport_buildextend_commands}" =~ (^| )"${cmd#buildextend-}"($| ) ]]; then + [[ "${nestos_unsupport_utility_commands}" =~ (^| )"${cmd}"($| ) ]] || \ + [[ "${cmd}" =~ ^buildextend-.* && "${nestos_unsupport_buildextend_commands}" =~ (^| )"${cmd#buildextend-}"($| ) ]]; then echo "Command ${cmd} is not applicable to NestOS" exit 1 fi -- Gitee