dtfscripts: Rename to concession

Ha
ha
This commit is contained in:
Salt 2018-09-27 21:02:24 -05:00
parent 15a8a181e2
commit 480c3b5e6d
20 changed files with 48 additions and 48 deletions

View File

@ -24,7 +24,7 @@ function svc_log() {
out=1 out=1
col_message="\e[37m" col_message="\e[37m"
fi fi
dtf_log "${col_svcname}${service_name}${col_reset}: ${col_message}${1}${col_reset}" >&${out} cnc_log "${col_svcname}${service_name}${col_reset}: ${col_message}${1}${col_reset}" >&${out}
} }
# Basic pre-start checks. Stick extra checks in prestart-extra # Basic pre-start checks. Stick extra checks in prestart-extra

View File

@ -19,6 +19,6 @@ function tsk_log() {
out=1 out=1
col_message="\e[37m" col_message="\e[37m"
fi fi
dtf_log "${col_tskname}${task}${col_reset}: ${col_message}${1}${col_reset}" >&${out} cnc_log "${col_tskname}${task}${col_reset}: ${col_message}${1}${col_reset}" >&${out}
} }

View File

@ -24,8 +24,8 @@
# General # General
unset TERMINAL unset TERMINAL
# Specific to these dtfscripts # Specific to these dtfscripts
unset DTF_SERVICES unset CNC_SERVICES
unset DTF_TASKS unset CNC_TASKS
# Polybar # Polybar
unset PB_MONITOR unset PB_MONITOR
unset PB_WM_RESTACK unset PB_WM_RESTACK
@ -42,7 +42,7 @@ unset BSPWM_DESKTOPS_TOTAL
unset BSPWM_DESKTOPS_PRIMARY unset BSPWM_DESKTOPS_PRIMARY
unset BSPWM_WINDOW_GAP unset BSPWM_WINDOW_GAP
function dtf_log() { function cnc_log() {
name="$(basename $0 .sh)" name="$(basename $0 .sh)"
if [ -z ${1+x} ]; then return 1; fi if [ -z ${1+x} ]; then return 1; fi
printf "$name: $1\n" printf "$name: $1\n"
@ -50,97 +50,97 @@ function dtf_log() {
## Patch some directories ## Patch some directories
if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then
dtf_log "Patching path for $HOME/.local/bin" cnc_log "Patching path for $HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
fi fi
if [[ "$XDG_CONFIG_HOME" == "" ]]; then if [[ "$XDG_CONFIG_HOME" == "" ]]; then
dtf_log "Correcting configuration directory" cnc_log "Correcting configuration directory"
export XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME="$HOME/.config"
fi fi
if [[ "$XDG_RUNTIME_DIR" == "" ]]; then if [[ "$XDG_RUNTIME_DIR" == "" ]]; then
dtf_log "Correcting runtime directory" cnc_log "Correcting runtime directory"
export XDG_RUNTIME_DIR="/run/user/$UID" export XDG_RUNTIME_DIR="/run/user/$UID"
fi fi
## Set some more variables ## Set some more variables
export DTF_HOME="$HOME/.dtfscripts" export CNC_HOME="$HOME/.concession"
export DTF_DEVICES_DIR="$DTF_HOME/devices" export CNC_DEVICES_DIR="$CNC_HOME/devices"
export DTF_SERVICES_DIR="$DTF_HOME/services" export CNC_SERVICES_DIR="$CNC_HOME/services"
export DTF_TASKS_DIR="$DTF_HOME/tasks" export CNC_TASKS_DIR="$CNC_HOME/tasks"
## Load device-specific scripts ## Load device-specific scripts
if [[ -x "$DTF_HOME/devices/$(hostname).rc" ]]; then if [[ -x "$CNC_DEVICES_DIR/$(hostname).rc" ]]; then
dtf_log "Sourcing devices/$(hostname).rc" cnc_log "Found device-specific config for $(hostname)"
source "$DTF_DEVICES_DIR/$(hostname).rc" source "$CNC_DEVICES_DIR/$(hostname).rc"
fi fi
## Determine which tasks to run ## Determine which tasks to run
# If DTF_TASKS is set, use that # If CNC_TASKS is set, use that
# Otherwise, run everything # Otherwise, run everything
if [[ "$DTF_TASKS" == "" ]]; then if [[ "$CNC_TASKS" == "" ]]; then
dtf_log "Performing all tasks" cnc_log "Performing all tasks"
for task in $DTF_TASKS_DIR/*; do for task in $CNC_TASKS_DIR/*; do
export DTF_TASKS="$DTF_TASKS $(basename "$task")" export CNC_TASKS="$CNC_TASKS $(basename "$task")"
done done
else else
dtf_log "Performing a subset of all tasks" cnc_log "Performing a subset of all tasks"
fi fi
## Define (and export) a task run function ## Define (and export) a task run function
function dtf_task_run() { function cnc_task_run() {
[ -z ${1+x} ] && return 1 [ -z ${1+x} ] && return 1
task_full="$DTF_TASKS_DIR/$1" task_full="$CNC_TASKS_DIR/$1"
( (
if ! [ -r "$task_full" ]; then if ! [ -r "$task_full" ]; then
dtf_log "Task is unreadable or missing: $task" cnc_log "Task is unreadable or missing: $task"
exit 1 exit 1
fi fi
if ! [ -x "$task_full" ]; then if ! [ -x "$task_full" ]; then
dtf_log "Task is unexecutable: $task" cnc_log "Task is unexecutable: $task"
exit 1 exit 1
fi fi
source "$DTF_HOME/common_task.sh" source "$CNC_HOME/common_task.sh"
source "$task_full" source "$task_full"
) )
} }
export -f dtf_task_run export -f cnc_task_run
## Run tasks ## Run tasks
for task in $DTF_TASKS; do for task in $CNC_TASKS; do
dtf_task_run $task cnc_task_run $task
done done
## Determine which services to run ## Determine which services to run
# Same as above # Same as above
if [[ "$DTF_SERVICES" == "" ]]; then if [[ "$CNC_SERVICES" == "" ]]; then
dtf_log "Starting all available services" cnc_log "Starting all available services"
for service in $DTF_SERVICES_DIR/*.dtf; do for service in $CNC_SERVICES_DIR/*.dtf; do
export DTF_SERVICES="$DTF_SERVICES $(basename "$service")" export CNC_SERVICES="$CNC_SERVICES $(basename "$service")"
done done
else else
dtf_log "Starting a subset of available services" cnc_log "Starting a subset of available services"
fi fi
## Define (and export) service functions ## Define (and export) service functions
function dtf_service_validate() { function cnc_service_validate() {
service_full="$DTF_SERVICES_DIR/$1" service_full="$CNC_SERVICES_DIR/$1"
if ! [ -r "$service_full" ]; then if ! [ -r "$service_full" ]; then
dtf_log "Service is unreadable or missing: $1" cnc_log "Service is unreadable or missing: $1"
return 1 return 1
fi fi
if ! [ -x "$service_full" ]; then if ! [ -x "$service_full" ]; then
dtf_log "Service is unexecutable: $1" cnc_log "Service is unexecutable: $1"
return 1 return 1
fi fi
return 0 return 0
} }
export -f dtf_service_validate export -f cnc_service_validate
function dtf_service_start() { function cnc_service_start() {
service_full="$DTF_SERVICES_DIR/$1" service_full="$CNC_SERVICES_DIR/$1"
dtf_service_validate $1 || return 1 cnc_service_validate $1 || return 1
( (
source "$DTF_HOME/common_service.sh" source "$CNC_HOME/common_service.sh"
source "$service_full" source "$service_full"
isup && [[ "$service_kill_on_reload" == "true" ]] && stop isup && [[ "$service_kill_on_reload" == "true" ]] && stop
prestart || exit 1 prestart || exit 1
@ -149,12 +149,12 @@ function dtf_service_start() {
start-extra start-extra
) )
} }
export -f dtf_service_start export -f cnc_service_start
## Run startup scripts ## Run startup scripts
for service in $DTF_SERVICES; do for service in $CNC_SERVICES; do
dtf_service_start $service cnc_service_start $service
done done
dtf_log "Finished initialization" cnc_log "Finished initialization"

View File

@ -21,7 +21,7 @@
# SOFTWARE. # SOFTWARE.
# Load session startup script # Load session startup script
dtfscript="$HOME/.dtfscripts/dtfscript" dtfscript="$HOME/.concession/concede"
if [[ -x "$dtfscript" ]]; then if [[ -x "$dtfscript" ]]; then
source "$dtfscript" source "$dtfscript"
exit 0 exit 0