#!/bin/bash
#   user - user configuration and temporary file support

set -e

lib_load 'core/host'

######
# Settings

core_user_config_init() {
	lib_setting_vars -ro user_confdir user_datadir user_logdir user_tempdir
	lib_setting_vars -ro user_id user_name user_email

	user_name=$(id -un)
	user_email=$user_name@$domain
}

user_confdir="$HOME/.$package_name"
user_datadir="$user_confdir/data"
user_logdir="$user_confdir/logs"
user_tempdir="$tmpdir/$package_name-$USER"

user_id=$(id -u)


######
# Public interface

is_superuser() { [[ "$user_id" -eq 0 ]]; }

require_superuser() {
	is_superuser || error "insufficient permission: you must run this tool as root"
}

user_tempfile() { tempfile -d "$user_tempdir"; }

View the Script Reference Index


Generated on Tue Apr 25 21:20:19 PDT 2017 by mcsh i7 v0.18.0.