diff --git a/usr/local/share/bastille/bootstrap.sh b/usr/local/share/bastille/bootstrap.sh index 74219638..c7d97dbc 100644 --- a/usr/local/share/bastille/bootstrap.sh +++ b/usr/local/share/bastille/bootstrap.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille bootstrap [option(s)] [RELEASE|TEMPLATE] [update|arch]" diff --git a/usr/local/share/bastille/clone.sh b/usr/local/share/bastille/clone.sh index 0db63835..74a88b78 100644 --- a/usr/local/share/bastille/clone.sh +++ b/usr/local/share/bastille/clone.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille clone [option(s)] TARGET NEW_NAME IP_ADDRESS" diff --git a/usr/local/share/bastille/cmd.sh b/usr/local/share/bastille/cmd.sh index 0d958973..cca0082e 100644 --- a/usr/local/share/bastille/cmd.sh +++ b/usr/local/share/bastille/cmd.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille cmd [option(s)] TARGET command" diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index fd62d6e2..763b0d17 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -30,11 +30,6 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Source config file -if [ -f /usr/local/etc/bastille/bastille.conf ]; then - . /usr/local/etc/bastille/bastille.conf -fi - COLOR_RED= COLOR_GREEN= COLOR_YELLOW= @@ -48,6 +43,18 @@ bastille_root_check() { fi } +load_config() { + _user="$(id -un)" + if [ "${_user}" != "root" ] && [ -r "/usr/local/etc/bastille/bastille_${_user}.conf" ]; then + . /usr/local/etc/bastille/bastille_${_user}.conf + else + . /usr/local/etc/bastille/bastille.conf + fi +} + +# Load configuration file +load_config + enable_color() { . /usr/local/share/bastille/colors.pre.sh } diff --git a/usr/local/share/bastille/config.sh b/usr/local/share/bastille/config.sh index a6ff11c5..0323d470 100644 --- a/usr/local/share/bastille/config.sh +++ b/usr/local/share/bastille/config.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille config TARGET [get|set] PROPERTY_NAME NEW_VALUE" diff --git a/usr/local/share/bastille/console.sh b/usr/local/share/bastille/console.sh index 33851a05..7b133287 100644 --- a/usr/local/share/bastille/console.sh +++ b/usr/local/share/bastille/console.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille console [option(s)] TARGET [user]" diff --git a/usr/local/share/bastille/convert.sh b/usr/local/share/bastille/convert.sh index d5d5b582..8b6d66fe 100644 --- a/usr/local/share/bastille/convert.sh +++ b/usr/local/share/bastille/convert.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille convert [option(s)] TARGET" diff --git a/usr/local/share/bastille/cp.sh b/usr/local/share/bastille/cp.sh index 0d1b53a1..c23a17e7 100644 --- a/usr/local/share/bastille/cp.sh +++ b/usr/local/share/bastille/cp.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille cp [option(s)] TARGET HOST_PATH JAIL_PATH" diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index 8ddcd11a..2f3783a5 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { # Build an independent usage for the create command diff --git a/usr/local/share/bastille/destroy.sh b/usr/local/share/bastille/destroy.sh index b18a670a..d590adf1 100644 --- a/usr/local/share/bastille/destroy.sh +++ b/usr/local/share/bastille/destroy.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille destroy [option(s)] [JAIL|RELEASE]" diff --git a/usr/local/share/bastille/edit.sh b/usr/local/share/bastille/edit.sh index 50c0ed88..0298da89 100644 --- a/usr/local/share/bastille/edit.sh +++ b/usr/local/share/bastille/edit.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille edit [option(s)] TARGET [filename]" diff --git a/usr/local/share/bastille/etcupdate.sh b/usr/local/share/bastille/etcupdate.sh index 2f625d41..4db33e7b 100644 --- a/usr/local/share/bastille/etcupdate.sh +++ b/usr/local/share/bastille/etcupdate.sh @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille etcupdate [option(s)] [bootstrap|TARGET] [diff|resolve|update RELEASE]" diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index f4d07fd4..584f1e36 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { # Build an independent usage for the export command diff --git a/usr/local/share/bastille/htop.sh b/usr/local/share/bastille/htop.sh index d6b108d8..1e0f796e 100644 --- a/usr/local/share/bastille/htop.sh +++ b/usr/local/share/bastille/htop.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille htop [option(s)] TARGET" diff --git a/usr/local/share/bastille/import.sh b/usr/local/share/bastille/import.sh index d76c8858..ec55fbd4 100644 --- a/usr/local/share/bastille/import.sh +++ b/usr/local/share/bastille/import.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { # Build an independent usage for the import command diff --git a/usr/local/share/bastille/jcp.sh b/usr/local/share/bastille/jcp.sh index fc8cf05e..ac2aa490 100644 --- a/usr/local/share/bastille/jcp.sh +++ b/usr/local/share/bastille/jcp.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille jcp [option(s)] SOURCE_JAIL JAIL_PATH DEST_JAIL JAIL_PATH" diff --git a/usr/local/share/bastille/limits.sh b/usr/local/share/bastille/limits.sh index 0418ffd7..b20b2a12 100644 --- a/usr/local/share/bastille/limits.sh +++ b/usr/local/share/bastille/limits.sh @@ -32,7 +32,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille limits [option(s)] TARGET OPTION VALUE" diff --git a/usr/local/share/bastille/list.sh b/usr/local/share/bastille/list.sh index c01875ab..3fd0dec5 100644 --- a/usr/local/share/bastille/list.sh +++ b/usr/local/share/bastille/list.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille list [option(s)] [-j|-a] [RELEASE (-p)] [template] [JAIL|CONTAINER] [log] [limit] [import] [export] [backup]" diff --git a/usr/local/share/bastille/mount.sh b/usr/local/share/bastille/mount.sh index f13c98ed..dd0e7bc0 100644 --- a/usr/local/share/bastille/mount.sh +++ b/usr/local/share/bastille/mount.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille mount [option(s)] TARGET HOST_PATH JAIL_PATH [filesystem_type options dump pass_number]" diff --git a/usr/local/share/bastille/pkg.sh b/usr/local/share/bastille/pkg.sh index c69f6763..fe4a000e 100644 --- a/usr/local/share/bastille/pkg.sh +++ b/usr/local/share/bastille/pkg.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille pkg [option(s)] TARGET COMMAND args" diff --git a/usr/local/share/bastille/rcp.sh b/usr/local/share/bastille/rcp.sh index f3880a0f..0c82b299 100644 --- a/usr/local/share/bastille/rcp.sh +++ b/usr/local/share/bastille/rcp.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille rcp [option(s)] TARGET JAIL_PATH HOST_PATH" diff --git a/usr/local/share/bastille/rdr.sh b/usr/local/share/bastille/rdr.sh index ef1e60a8..bc9c26b7 100644 --- a/usr/local/share/bastille/rdr.sh +++ b/usr/local/share/bastille/rdr.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille rdr [option(s)] TARGET [clear|reset|list|(tcp|udp)] HOST_PORT JAIL_PORT [log ['(' logopts ')'] ]" diff --git a/usr/local/share/bastille/rename.sh b/usr/local/share/bastille/rename.sh index 7aa887b8..41600f75 100644 --- a/usr/local/share/bastille/rename.sh +++ b/usr/local/share/bastille/rename.sh @@ -29,7 +29,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille rename [option(s)] TARGET NEW_NAME" diff --git a/usr/local/share/bastille/service.sh b/usr/local/share/bastille/service.sh index 40551def..1bb7fc27 100644 --- a/usr/local/share/bastille/service.sh +++ b/usr/local/share/bastille/service.sh @@ -31,6 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh +load_config usage() { error_notify "Usage: bastille service [options(s)] TARGET SERVICE_NAME ACTION" diff --git a/usr/local/share/bastille/setup.sh b/usr/local/share/bastille/setup.sh index 020d2cf4..726c08f8 100644 --- a/usr/local/share/bastille/setup.sh +++ b/usr/local/share/bastille/setup.sh @@ -30,10 +30,8 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -bastille_config="/usr/local/etc/bastille/bastille.conf" . /usr/local/share/bastille/common.sh -# shellcheck source=/usr/local/etc/bastille/bastille.conf -. ${bastille_config} +load_config usage() { error_exit "Usage: bastille setup [pf|network|zfs|vnet]" diff --git a/usr/local/share/bastille/start.sh b/usr/local/share/bastille/start.sh index 8a0960d1..923b338b 100644 --- a/usr/local/share/bastille/start.sh +++ b/usr/local/share/bastille/start.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille start [option(s)] TARGET" diff --git a/usr/local/share/bastille/stop.sh b/usr/local/share/bastille/stop.sh index faafe4cc..0a921baf 100644 --- a/usr/local/share/bastille/stop.sh +++ b/usr/local/share/bastille/stop.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille stop [option(s)] TARGET" diff --git a/usr/local/share/bastille/sysrc.sh b/usr/local/share/bastille/sysrc.sh index f2361ab1..3b5bbb19 100644 --- a/usr/local/share/bastille/sysrc.sh +++ b/usr/local/share/bastille/sysrc.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille sysrc [option(s)] TARGET args" diff --git a/usr/local/share/bastille/tags.sh b/usr/local/share/bastille/tags.sh index 0285570f..3bba6941 100644 --- a/usr/local/share/bastille/tags.sh +++ b/usr/local/share/bastille/tags.sh @@ -32,7 +32,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille tags TARGET [add|delete|list] [tag1,tag2]" diff --git a/usr/local/share/bastille/template.sh b/usr/local/share/bastille/template.sh index eec08752..5c4de5ee 100644 --- a/usr/local/share/bastille/template.sh +++ b/usr/local/share/bastille/template.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille template [option(s)] TARGET [--convert|project/template]" diff --git a/usr/local/share/bastille/top.sh b/usr/local/share/bastille/top.sh index ef2a8bcb..3883b126 100644 --- a/usr/local/share/bastille/top.sh +++ b/usr/local/share/bastille/top.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille top [options(s)] TARGET" diff --git a/usr/local/share/bastille/umount.sh b/usr/local/share/bastille/umount.sh index 89017dfd..36a147cc 100644 --- a/usr/local/share/bastille/umount.sh +++ b/usr/local/share/bastille/umount.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille umount [option(s)] TARGET JAIL_PATH" diff --git a/usr/local/share/bastille/update.sh b/usr/local/share/bastille/update.sh index 1a387b36..a5665b78 100644 --- a/usr/local/share/bastille/update.sh +++ b/usr/local/share/bastille/update.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille update [option(s)] TARGET" diff --git a/usr/local/share/bastille/upgrade.sh b/usr/local/share/bastille/upgrade.sh index 5d92d181..eb2b7e0a 100644 --- a/usr/local/share/bastille/upgrade.sh +++ b/usr/local/share/bastille/upgrade.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille upgrade [option(s)] TARGET [NEWRELEASE|install]" diff --git a/usr/local/share/bastille/verify.sh b/usr/local/share/bastille/verify.sh index b82b5d93..7309883d 100644 --- a/usr/local/share/bastille/verify.sh +++ b/usr/local/share/bastille/verify.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille verify [RELEASE|TEMPLATE]" diff --git a/usr/local/share/bastille/zfs.sh b/usr/local/share/bastille/zfs.sh index 8ffef062..8d1e6cc2 100644 --- a/usr/local/share/bastille/zfs.sh +++ b/usr/local/share/bastille/zfs.sh @@ -31,7 +31,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . /usr/local/share/bastille/common.sh -. /usr/local/etc/bastille/bastille.conf +load_config usage() { error_notify "Usage: bastille zfs TARGET [set|get|snap|destroy_snap|df|usage] [key=value|date]"