mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-26 07:21:15 +01:00
Update list command and config
This commit is contained in:
@@ -3,40 +3,43 @@
|
||||
#####################
|
||||
|
||||
## default paths
|
||||
bastille_prefix=/usr/local/bastille ## default: "/usr/local/bastille"
|
||||
bastille_backupsdir=${bastille_prefix}/backups ## default: ${bastille_prefix}/backups
|
||||
bastille_cachedir=${bastille_prefix}/cache ## default: ${bastille_prefix}/cache
|
||||
bastille_jailsdir=${bastille_prefix}/jails ## default: ${bastille_prefix}/jails
|
||||
bastille_logsdir=${bastille_prefix}/logs ## default: ${bastille_prefix}/logs
|
||||
bastille_releasesdir=${bastille_prefix}/releases ## default: ${bastille_prefix}/releases
|
||||
bastille_templatesdir=${bastille_prefix}/templates ## default: ${bastille_prefix}/templates
|
||||
bastille_prefix=/usr/local/bastille ## default: "/usr/local/bastille"
|
||||
bastille_backupsdir=${bastille_prefix}/backups ## default: ${bastille_prefix}/backups
|
||||
bastille_cachedir=${bastille_prefix}/cache ## default: ${bastille_prefix}/cache
|
||||
bastille_jailsdir=${bastille_prefix}/jails ## default: ${bastille_prefix}/jails
|
||||
bastille_logsdir=${bastille_prefix}/logs ## default: ${bastille_prefix}/logs
|
||||
bastille_releasesdir=${bastille_prefix}/releases ## default: ${bastille_prefix}/releases
|
||||
bastille_templatesdir=${bastille_prefix}/templates ## default: ${bastille_prefix}/templates
|
||||
|
||||
## 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)
|
||||
bastille_bootstrap_archives="base" ## default: "base"
|
||||
bastille_bootstrap_archives="base" ## default: "base"
|
||||
|
||||
## default timezone
|
||||
bastille_tzdata="etc/UTC" ## default: "etc/UTC"
|
||||
bastille_tzdata="etc/UTC" ## default: "etc/UTC"
|
||||
|
||||
## 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
|
||||
bastille_zfs_enable="" ## default: ""
|
||||
bastille_zfs_zpool="" ## default: ""
|
||||
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_enable="" ## default: ""
|
||||
bastille_zfs_zpool="" ## default: ""
|
||||
bastille_zfs_prefix="bastille" ## default: "${bastille_zfs_zpool}/bastille"
|
||||
bastille_zfs_options="-o compress=lz4 -o atime=off" ## default: "-o compress=lz4 -o atime=off"
|
||||
|
||||
## Export/Import options
|
||||
bastille_compress_xz_options="-0 -v" ## default "-0 -v"
|
||||
bastille_decompress_xz_options="-c -d -v" ## default "-c -d -v"
|
||||
bastille_compress_xz_options="-0 -v" ## default "-0 -v"
|
||||
bastille_decompress_xz_options="-c -d -v" ## default "-c -d -v"
|
||||
|
||||
## Networking
|
||||
bastille_jail_loopback="lo1" ## default: "lo1"
|
||||
bastille_jail_interface="bastille0" ## default: "bastille0"
|
||||
bastille_jail_external="" ## default: ""
|
||||
bastille_jail_addr="10.17.89.10" ## default: "10.17.89.10"
|
||||
bastille_jail_gateway="" ## default: ""
|
||||
bastille_jail_loopback="lo1" ## default: "lo1"
|
||||
bastille_jail_interface="bastille0" ## default: "bastille0"
|
||||
bastille_jail_external="" ## default: ""
|
||||
bastille_jail_addr="10.17.89.10" ## default: "10.17.89.10"
|
||||
bastille_jail_gateway="" ## default: ""
|
||||
|
||||
@@ -181,21 +181,12 @@ if [ ! -d "${bastille_backupsdir}" ]; then
|
||||
error_notify "${COLOR_RED}Backups directory/dataset does not exist, See 'bastille bootstrap'.${COLOR_RESET}"
|
||||
fi
|
||||
|
||||
# Handle additional options
|
||||
case "${TARGET}" in
|
||||
list)
|
||||
ls "${bastille_backupsdir}" | grep -Ev "*.sha256"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
# 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 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
|
||||
|
||||
# Check if a running jail matches name or already exist
|
||||
if [ -n "$(jls name | awk "/^${TARGET_TRIM}$/")" ]; then
|
||||
|
||||
@@ -80,6 +80,10 @@ if [ $# -gt 0 ]; then
|
||||
limit|limits)
|
||||
rctl -h jail:
|
||||
;;
|
||||
import|imports|export|exports|backup|backups)
|
||||
ls "${bastille_backupsdir}" | grep -Ev "*.sha256"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user