warewulf4/verbose-exec.patch
Egbert Eich e76a9480c0 - Warewulf v4.5.8 simplifies the wwinit boot process for SELinux
and configures tmpfs to spread the node image across all
  available NUMA nodes. It also improves the detection of kernels
  in the container image to more reliably detect the newest
  available kernel and to avoid debug / rescue kernels.
- Warewulf v4.5.7 fixes the ability to override overlay files
  configured in profiles with overlays configured per-node; fixes
  a template processing bug bug in development-time overlay
  rendering; and improves the preview dracut-based boot process to
  better support a "secure" boot process.
- removed added-cow-option-to-bind.patch as now in upstream
  * Show more information during `wwctl container <shell|exec>`
    about when and if the container image will be rebuilt.
  * Command-line completion for `wwctl overlay <edit|delete|chmod|chown>`.
  * Display an error during boot if no container is defined.
  * `wwctl container list --kernel` shows the kernel detected for
    each container.
  *  `wwctl container list --size` shows the uncompressed size of
     each container. `--compressed` shows the compressed size, and
     `--chroot` shows the size of the container source on the server.
  * Add a logrotate config for `warewulfd.log`.

OBS-URL: https://build.opensuse.org/package/show/network:cluster/warewulf4?expand=0&rev=95
2025-01-13 12:20:47 +00:00

27 lines
1.2 KiB
Diff

diff --git a/internal/app/wwctl/container/exec/child/main.go b/internal/app/wwctl/container/exec/child/main.go
index a6502111..715e0db8 100644
--- a/internal/app/wwctl/container/exec/child/main.go
+++ b/internal/app/wwctl/container/exec/child/main.go
@@ -21,6 +21,11 @@ import (
"github.com/warewulf/warewulf/internal/pkg/wwlog"
)
+const exitEval = `$(VALU="$?" ; if [ $VALU == 0 ]; then echo write; else echo discard; fi)`
+const msgStr = `Changes are written back to container and image is rebuilt
+depending on exit status of last called program.
+Type "true" or "false" to enforce or abort image rebuilt.`
+
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
if os.Getpid() != 1 {
wwlog.Error("PID is not 1: %d", os.Getpid())
@@ -79,7 +84,8 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
if err != nil {
return errors.Wrap(err, "failed to mount")
}
- ps1Str := fmt.Sprintf("[%s] Warewulf> ", containerName)
+ ps1Str := fmt.Sprintf("[%s|%s] Warewulf> ", exitEval, containerName)
+ wwlog.Info(msgStr)
if len(lowerObjects) != 0 && nodename == "" {
options := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s",
path.Join(runDir, "lower"), containerPath, path.Join(runDir, "work"))