From 914d4c24f83d1bc1e8f5b2e50cc1b460f7db3e3c Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sun, 13 Dec 2020 14:37:20 +0100 Subject: [PATCH] fetch => fetchports (more clarity) --- jaildk | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/jaildk b/jaildk index 10c122d..2c4b4f8 100755 --- a/jaildk +++ b/jaildk @@ -15,7 +15,7 @@ base -b [-w] - build a new base build [-b ] [-v ] - install a build chroot of a jail create - create a new jail from a template clone -s -d [-o ] [-n ] - clone an existing jail or jail version -fetch - fetch current port collection +fetchports [-v ] - fetch current port collection ${beg}Installing Jails:${end} install [-r function] - install a jail (prepare mounts, devfs etc) @@ -320,8 +320,13 @@ jaildk_rc_ports() { load-jail-config $jail - if test -n "$ports"; then - version="$ports" + if test -z "$ports"; then + # ports not configured, abort + return + fi + + if ! test -d "$j/ports/$VERSION"; then + die "Ports tree $j/ports/$VERSION doesn't exist yet. Consider creating it with 'jaildk fetchports [-v ]'" fi if test -n "$buildbase" -a -n "$rw"; then @@ -705,7 +710,7 @@ var/tmp" read yesno case $yesno in y|Y|yes|YES) - jaildk_fetch + jaildk_fetchports ;; esac fi @@ -1316,8 +1321,21 @@ endif esac } -jaildk_fetch() { +usage_fetchports() { + die "Usage $0 fetchports [-v ] +Fetch current portscollection, use or todays timestamp as new version" +} + +jaildk_fetchports() { version=`date +%Y%m%d` + + while getopts "v:" arg; do + case $arg in + v) version=${OPTARG};; + *) usage_fetchports;; + esac + done + if test -d "$j/ports/$version"; then echo -n "Ports dir $version already exist. Do you want to recreate it [y/N]? " read yesno @@ -1641,7 +1659,7 @@ case $runner in start|stop|status|restart) jaildk_jail $runner $* ;; - setup|reinstall|install|uninstall|build|blogin|login|clone|create|remove|rc|base|fetch|freeze|thaw|ipfw) + setup|reinstall|install|uninstall|build|blogin|login|clone|create|remove|rc|base|fetchports|freeze|thaw|ipfw) jaildk_$runner $* ;; help)