Update list command and config

This commit is contained in:
Jose
2020-01-28 18:57:51 -04:00
parent 095075b142
commit 38ae0ed4a6
3 changed files with 36 additions and 38 deletions

View File

@@ -3,40 +3,43 @@
##################### #####################
## default paths ## default paths
bastille_prefix=/usr/local/bastille ## default: "/usr/local/bastille" bastille_prefix=/usr/local/bastille ## default: "/usr/local/bastille"
bastille_backupsdir=${bastille_prefix}/backups ## default: ${bastille_prefix}/backups bastille_backupsdir=${bastille_prefix}/backups ## default: ${bastille_prefix}/backups
bastille_cachedir=${bastille_prefix}/cache ## default: ${bastille_prefix}/cache bastille_cachedir=${bastille_prefix}/cache ## default: ${bastille_prefix}/cache
bastille_jailsdir=${bastille_prefix}/jails ## default: ${bastille_prefix}/jails bastille_jailsdir=${bastille_prefix}/jails ## default: ${bastille_prefix}/jails
bastille_logsdir=${bastille_prefix}/logs ## default: ${bastille_prefix}/logs bastille_logsdir=${bastille_prefix}/logs ## default: ${bastille_prefix}/logs
bastille_releasesdir=${bastille_prefix}/releases ## default: ${bastille_prefix}/releases bastille_releasesdir=${bastille_prefix}/releases ## default: ${bastille_prefix}/releases
bastille_templatesdir=${bastille_prefix}/templates ## default: ${bastille_prefix}/templates bastille_templatesdir=${bastille_prefix}/templates ## default: ${bastille_prefix}/templates
## bastille scripts directory (assumed by bastille pkg) ## bastille scripts directory (assumed by bastille pkg)
bastille_sharedir=/usr/local/share/bastille ## default: "/usr/local/share/bastille" bastille_sharedir=/usr/local/share/bastille ## default: "/usr/local/share/bastille"
## bootstrap archives (base, lib32, ports, src, test) ## bootstrap archives (base, lib32, ports, src, test)
bastille_bootstrap_archives="base" ## default: "base" bastille_bootstrap_archives="base" ## default: "base"
## default timezone ## default timezone
bastille_tzdata="etc/UTC" ## default: "etc/UTC" bastille_tzdata="etc/UTC" ## default: "etc/UTC"
## default jail resolv.conf ## default jail resolv.conf
bastille_resolv_conf="/etc/resolv.conf" ## default: "/etc/resolv.conf" bastille_resolv_conf="/etc/resolv.conf" ## default: "/etc/resolv.conf"
## bootstrap urls
bastille_url_freebsd="http://ftp.freebsd.org/pub/FreeBSD/releases/" ## default: "http://ftp.freebsd.org/pub/FreeBSD/releases/"
bastille_url_hardenedbsd="https://installer.hardenedbsd.org/pub/HardenedBSD/releases/" ## default: "https://installer.hardenedbsd.org/pub/HardenedBSD/releases/"
## ZFS options ## ZFS options
bastille_zfs_enable="" ## default: "" bastille_zfs_enable="" ## default: ""
bastille_zfs_zpool="" ## default: "" bastille_zfs_zpool="" ## default: ""
bastille_zfs_prefix="bastille" ## default: "${bastille_zfs_zpool}/bastille" bastille_zfs_prefix="bastille" ## default: "${bastille_zfs_zpool}/bastille"
bastille_zfs_mountpoint=${bastille_prefix} ## default: "${bastille_prefix}" bastille_zfs_options="-o compress=lz4 -o atime=off" ## default: "-o compress=lz4 -o atime=off"
bastille_zfs_options="-o compress=lz4 -o atime=off" ## default: "-o compress=lz4 -o atime=off"
## Export/Import options ## Export/Import options
bastille_compress_xz_options="-0 -v" ## default "-0 -v" bastille_compress_xz_options="-0 -v" ## default "-0 -v"
bastille_decompress_xz_options="-c -d -v" ## default "-c -d -v" bastille_decompress_xz_options="-c -d -v" ## default "-c -d -v"
## Networking ## Networking
bastille_jail_loopback="lo1" ## default: "lo1" bastille_jail_loopback="lo1" ## default: "lo1"
bastille_jail_interface="bastille0" ## default: "bastille0" bastille_jail_interface="bastille0" ## default: "bastille0"
bastille_jail_external="" ## default: "" bastille_jail_external="" ## default: ""
bastille_jail_addr="10.17.89.10" ## default: "10.17.89.10" bastille_jail_addr="10.17.89.10" ## default: "10.17.89.10"
bastille_jail_gateway="" ## default: "" bastille_jail_gateway="" ## default: ""

View File

@@ -181,21 +181,12 @@ if [ ! -d "${bastille_backupsdir}" ]; then
error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}" error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}"
fi fi
# Handle additional options # Check if archive exist then trim archive name
case "${TARGET}" in if [ "$(ls "${bastille_backupsdir}" | awk "/^${TARGET}$/")" ]; then
list) TARGET_TRIM=$(echo ${TARGET} | sed "s/_[0-9]*-[0-9]*-[0-9]*-[0-9]*:[0-9]*:[0-9]*.[txz]\{2,3\}//")
ls "${bastille_backupsdir}" | grep -Ev "*.sha256" else
exit 0 error_notify "${COLOR_RED}Archive '${TARGET}' not found.${COLOR_RESET}"
;; fi
*)
# Check if archive exist then trim archive name
if [ "$(ls "${bastille_backupsdir}" | awk "/^${TARGET}$/")" ]; then
TARGET_TRIM=$(echo ${TARGET} | sed "s/_[0-9]*-[0-9]*-[0-9]*-[0-9]*:[0-9]*:[0-9]*.[txz]\{2,3\}//")
else
error_notify "${COLOR_RED}Archive '${TARGET}' not found.${COLOR_RESET}"
fi
;;
esac
# Check if a running jail matches name or already exist # Check if a running jail matches name or already exist
if [ -n "$(jls name | awk "/^${TARGET_TRIM}$/")" ]; then if [ -n "$(jls name | awk "/^${TARGET_TRIM}$/")" ]; then

View File

@@ -80,6 +80,10 @@ if [ $# -gt 0 ]; then
limit|limits) limit|limits)
rctl -h jail: rctl -h jail:
;; ;;
import|imports|export|exports|backup|backups)
ls "${bastille_backupsdir}" | grep -Ev "*.sha256"
exit 0
;;
*) *)
usage usage
;; ;;