From 979558098fea8ac5b584cabd751fa83c6608ec21 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Mon, 27 Aug 2018 22:43:16 -0500
Subject: [PATCH] Revert "dtfscript: Move environment setup to its own script"

Originally this was gonna be used for a standalone service management
script. As it turns out, it's a bad idea to do it this way.
---
 .config/dtfscripts/common.sh | 29 ------------------------
 .config/dtfscripts/dtfscript | 44 ++++++++++++++++++++++++++++++++----
 2 files changed, 40 insertions(+), 33 deletions(-)
 delete mode 100755 .config/dtfscripts/common.sh

diff --git a/.config/dtfscripts/common.sh b/.config/dtfscripts/common.sh
deleted file mode 100755
index 6dc4ec10..00000000
--- a/.config/dtfscripts/common.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2018 rehashedsalt
-# Licensed to all under the terms of the MIT License
-
-function dtf_log() {
-	name="$(basename $0 .sh)"
-	if [ -z ${1+x} ]; then return 1; fi
-	printf "$name: $1\n"
-}
-
-## Patch some directories
-if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then
-	dtf_log "Patching path for $HOME/.local/bin"
-	export PATH="$HOME/.local/bin:$PATH"
-fi
-if [[ "$XDG_CONFIG_HOME" == "" ]]; then
-	dtf_log "Correcting configuration directory"
-	export XDG_CONFIG_HOME="$HOME/.config"
-fi
-if [[ "$XDG_RUNTIME_DIR" == "" ]]; then
-	dtf_log "Correcting runtime directory"
-	export XDG_RUNTIME_DIR="/run/user/$UID"
-fi
-
-## Set some more variables
-export DTF_CONFIG_HOME="$XDG_CONFIG_HOME/dtfscripts"
-export DTF_SERVICES_DIR="$DTF_CONFIG_HOME/services"
-export DTF_TASKS_DIR="$DTF_CONFIG_HOME/tasks"
-
diff --git a/.config/dtfscripts/dtfscript b/.config/dtfscripts/dtfscript
index b906556a..7bd2409c 100755
--- a/.config/dtfscripts/dtfscript
+++ b/.config/dtfscripts/dtfscript
@@ -1,6 +1,24 @@
 #!/usr/bin/env bash
-# Copyright 2018 rehashedsalt
-# Licensed to all under the terms of the MIT License
+
+# Copyright (c) 2018 rehashedsalt/vintagesalt
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
 
 ## Clean up some variables
 # General
@@ -22,12 +40,30 @@ unset PB_MODULE_WLAN_INTERFACE
 unset BSPWM_DESKTOPS_TOTAL
 unset BSPWM_DESKTOPS_PRIMARY
 
-## Simple patches to get to the common environment script
+function dtf_log() {
+	name="$(basename $0 .sh)"
+	if [ -z ${1+x} ]; then return 1; fi
+	printf "$name: $1\n"
+}
+
+## Patch some directories
+if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then
+	dtf_log "Patching path for $HOME/.local/bin"
+	export PATH="$HOME/.local/bin:$PATH"
+fi
 if [[ "$XDG_CONFIG_HOME" == "" ]]; then
+	dtf_log "Correcting configuration directory"
 	export XDG_CONFIG_HOME="$HOME/.config"
 fi
+if [[ "$XDG_RUNTIME_DIR" == "" ]]; then
+	dtf_log "Correcting runtime directory"
+	export XDG_RUNTIME_DIR="/run/user/$UID"
+fi
+
+## Set some more variables
 export DTF_CONFIG_HOME="$XDG_CONFIG_HOME/dtfscripts"
-source "$DTF_CONFIG_HOME/common.sh"
+export DTF_SERVICES_DIR="$DTF_CONFIG_HOME/services"
+export DTF_TASKS_DIR="$DTF_CONFIG_HOME/tasks"
 
 ## Load device-specific scripts
 if [[ -x "$DTF_CONFIG_HOME/devices/$(hostname).rc" ]]; then