Logic moved from truckle to cave.
truckle commands to cave added: `cave do`, `cave retry`, `cave upgrade` You do not need truckle upgrade, now sudo cave upgrade works, too. These commands do not depend on truckle, it works fine with cave-only. Environment variables added via `/etc/profile.d/cave.sh`. At the moment only resume-file-depended variables (TRUCKLE_RESUME_FILE, CAVE_RESUME_OPTIONS, CAVE_RESOLVE_OPTIONS, ...) If you use cave, the resume-file will be used automaticaly. You do not need truckle anymore to have auto-resume-files. But sudo will remove these from env... Sudoers-config for cave added via `/etc/sudoers.d/cave`. sudo will keep the same variables like defined in `/etc/profile.d/cave.sh`. I do not know, but i think it can be a security hole. But never allow users to use cave as root! So, now you can use sudo, too. These combinations of new cave-related changes will allow this: sudo cave upgrade sudo cave do # something went wrong? sudo cave retry Only pagered it is easier with truckle: sudo cave -cy upgrade | less -R # vs. truckle upgrade
This commit is contained in:
parent
3828c4a740
commit
3782f838eb
19
Makefile
19
Makefile
|
@ -2,20 +2,35 @@
|
||||||
# vi:set filetype=makefile
|
# vi:set filetype=makefile
|
||||||
NULL=0 exec make "CALL=$0" "EXE=`which $0`" -f "`which $0`" -- "$@"
|
NULL=0 exec make "CALL=$0" "EXE=`which $0`" -f "`which $0`" -- "$@"
|
||||||
|
|
||||||
D := /
|
|
||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
BIN_PREFIX := $(PREFIX)/bin
|
BIN_PREFIX := $(PREFIX)/bin
|
||||||
|
CAVE_COMMANDS_PREFIX := /usr/libexec/cave/commands
|
||||||
|
SYS_CONF_DIR := /etc
|
||||||
|
PROFILE_DIR := $(SYS_CONF_DIR)/profile.d
|
||||||
|
SUDOERS_DIR := $(SYS_CONF_DIR)/sudoers.d
|
||||||
|
D += /
|
||||||
|
|
||||||
all: truckle
|
all: truckle
|
||||||
@echo 'Nothing to do :)'
|
@echo 'Nothing to do :)'
|
||||||
@echo 'Please run "make install" to install.'
|
@echo 'Please run "make install" to install.'
|
||||||
|
|
||||||
install: truckle
|
install_truckle: truckle
|
||||||
mkdir -p $(D)$(BIN_PREFIX)
|
mkdir -p $(D)$(BIN_PREFIX)
|
||||||
install -m 0755 truckle $(D)$(BIN_PREFIX)/truckle
|
install -m 0755 truckle $(D)$(BIN_PREFIX)/truckle
|
||||||
for c in `./truckle --list-commands`; do ln -fs truckle $(D)$(BIN_PREFIX)/truckle-$${c} ; done
|
for c in `./truckle --list-commands`; do ln -fs truckle $(D)$(BIN_PREFIX)/truckle-$${c} ; done
|
||||||
for c in trdo tresume tretry; do ln -fs truckle $(D)$(BIN_PREFIX)/$${c} ; done
|
for c in trdo tresume tretry; do ln -fs truckle $(D)$(BIN_PREFIX)/$${c} ; done
|
||||||
|
|
||||||
|
install_cave_commands:
|
||||||
|
mkdir -p $(D)$(CAVE_COMMANDS_PREFIX)
|
||||||
|
install -m 0755 -o root -g root -t $(D)$(CAVE_COMMANDS_PREFIX) cave_commands/*
|
||||||
|
|
||||||
|
install_configs:
|
||||||
|
mkdir -p $(D)$(PROFILE_DIR) $(D)$(SUDOERS_DIR)
|
||||||
|
install -m 0644 -o root -g root configs/profile.sh $(D)$(PROFILE_DIR)/cave.sh
|
||||||
|
install -m 0440 -o root -g root configs/sudoers $(D)$(SUDOERS_DIR)/cave
|
||||||
|
|
||||||
|
install: install_truckle install_cave_commands install_configs
|
||||||
|
|
||||||
README.md: truckle README.pre.md
|
README.md: truckle README.pre.md
|
||||||
( cat README.pre.md ; ./truckle --help ) > README.md.tmp
|
( cat README.pre.md ; ./truckle --help ) > README.md.tmp
|
||||||
mv README.md.tmp README.md
|
mv README.md.tmp README.md
|
||||||
|
|
2
cave_commands/do
Executable file
2
cave_commands/do
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
exec ${CAVE} resume "${@}"
|
2
cave_commands/retry
Executable file
2
cave_commands/retry
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
exec ${CAVE} resume --retry-failed --retry-skipped "${@}"
|
2
cave_commands/upgrade
Executable file
2
cave_commands/upgrade
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
exec ${CAVE} resolve -c world "${@}"
|
8
configs/profile.sh
Normal file
8
configs/profile.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
TRUCKLE_RESUME_FILE="/tmp/truckle-resume-pid-${$}"
|
||||||
|
CAVE_all_commands_OPTIONS="--resume-file ${TRUCKLE_RESUME_FILE}"
|
||||||
|
CAVE_RESOLVE_OPTIONS="${CAVE_all_commands_OPTIONS}"
|
||||||
|
CAVE_RESUME_OPTIONS="${CAVE_all_commands_OPTIONS}"
|
||||||
|
CAVE_FIX_LINKAGE_OPTIONS="${CAVE_all_commands_OPTIONS}"
|
||||||
|
CAVE_UNINSTALL_OPTIONS="${CAVE_all_commands_OPTIONS}"
|
||||||
|
export TRUCKLE_RESUME_FILE CAVE_all_commands_OPTIONS CAVE_RESOLVE_OPTIONS
|
||||||
|
export CAVE_RESUME_OPTIONS CAVE_FIX_LINKAGE_OPTIONS CAVE_UNINSTALL_OPTIONS
|
1
configs/sudoers
Normal file
1
configs/sudoers
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Defaults env_keep += "TRUCKLE_RESUME_FILE* CAVE_RESUME_OPTIONS CAVE_RESOLVE_OPTIONS CAVE_RESUME_OPTIONS CAVE_FIX_LINKAGE_OPTIONS CAVE_UNINSTALL_OPTIONS"
|
12
truckle
12
truckle
|
@ -183,8 +183,12 @@ class RunCave
|
||||||
puts a.shelljoin
|
puts a.shelljoin
|
||||||
0
|
0
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
Kernel.system *a
|
Kernel.system *a
|
||||||
$? && $?.exitstatus
|
$? && $?.exitstatus
|
||||||
|
rescue Interrupt
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -385,16 +389,12 @@ EOF
|
||||||
cave.()
|
cave.()
|
||||||
}
|
}
|
||||||
cmds.on :remove, &sudo_pagered {|cmd, *args| cave.resumable!.uninstall(*args).()}
|
cmds.on :remove, &sudo_pagered {|cmd, *args| cave.resumable!.uninstall(*args).()}
|
||||||
cmds.on :upgrade, &sudo_pagered {|cmd, *args|
|
cmds.on :upgrade, &sudo_pagered {|*args| cave.resumable!.this( *args).() }
|
||||||
cave.resumable!.resolve( '-c', :world, *args).()
|
|
||||||
}
|
|
||||||
cmds.on :install, &sudod {|cmd, *argv| cave.resumable!.resolve( '-x', *argv).() }
|
cmds.on :install, &sudod {|cmd, *argv| cave.resumable!.resolve( '-x', *argv).() }
|
||||||
cmds.on :uninstall, &sudod {|cmd, *argv| cave.resumable!.uninstall( '-x', *argv).() }
|
cmds.on :uninstall, &sudod {|cmd, *argv| cave.resumable!.uninstall( '-x', *argv).() }
|
||||||
|
|
||||||
cmds.on :do, :resume, &sudod {|cmd, *args| cave.resumable!.resume( *args).() }
|
cmds.on :do, :resume, &sudod {|cmd, *args| cave.resumable!.resume( *args).() }
|
||||||
cmds.on :retry, &sudod {|cmd, *args|
|
cmds.on :retry, &sudod {|*args| cave.resumable!.this( *args).() }
|
||||||
cave.resumable!.resume( '--retry-failed', '--retry-skipped', *args).()
|
|
||||||
}
|
|
||||||
|
|
||||||
cmds.on '--list-commands', &pagered { puts cmds.map {|k,v| k } }
|
cmds.on '--list-commands', &pagered { puts cmds.map {|k,v| k } }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue