diff --git a/home/dot_bashrc b/home/dot_bashrc index e61a0f4b..05abbd32 100644 --- a/home/dot_bashrc +++ b/home/dot_bashrc @@ -139,6 +139,7 @@ if [ "$BASH_SUPPORT" = 'true' ] && [ -n "$BASH" ]; then [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/goto.sh" ] || source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/goto.sh" ### hiSHtory + # Hishtory Config: if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.sh" ]; then export PATH="$PATH:${XDG_CONFIG_HOME:-$HOME/.config}/hishtory" source "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.sh" diff --git a/home/dot_local/bin/executable_installx b/home/dot_local/bin/executable_installx index 61e0eb1c..db3cf06d 100644 --- a/home/dot_local/bin/executable_installx +++ b/home/dot_local/bin/executable_installx @@ -33,7 +33,7 @@ async function runSilentCommand(command) { async function runScript(key, script) { log(`Running script..`) fs.writeFileSync(`${cacheDir}/${key}-raw`, script) - const [ templatedScript, file, brief ] = await Promise.all([ + const [templatedScript, file, brief] = await Promise.all([ $`cat "${cacheDir}/${key}-raw" | chezmoi execute-template`, $`cat "${cacheDir}/${key}-raw" | ( grep "^# @file" || [ "$?" == "1" ] ) | sed 's/^# @file //'`, $`cat "${cacheDir}/${key}-raw" | ( grep "^# @brief" || [ "$?" == "1" ] ) | sed 's/^# @brief //'` @@ -144,6 +144,7 @@ function expandDeps(keys) { } async function createCaskLinks(caskMap) { + if (!caskMap) return const caskApps = caskMap .filter(x => { // Filter out macOS apps that already have a _app installed @@ -238,6 +239,7 @@ async function bundleInstall(brews, casks, caskMap) { lines.push(`brew "${brew}"`) } log(`Creating Brewfile to install from`) + cd(await $`mktemp -d`) fs.writeFileSync('Brewfile', lines.join('\n')) log(`Installing packages via brew bundle`) await $`brew bundle --file Brewfile` @@ -560,7 +562,7 @@ async function main() { } else { const groups = typeof x[groupsField] === 'string' ? [x[groupsField]] : x[groupsField] return groups.flatMap(y => { - return $`sudo "${os.homedir()}/.local/bin/add-usergroup" "${process.env.USER}" "${x[]}"` + return $`sudo "${os.homedir()}/.local/bin/add-usergroup" "${process.env.USER}" "${y}"` }) } }) @@ -576,19 +578,19 @@ async function main() { log(`Running post-install scripts defined in ~/.local/bin/post-installx`) const postScriptFiles = installData .flatMap(x => { - const scriptPath = `${os.homedir()}/.local/bin/post-installx/post-${x.installKey}.sh` + const scriptPath = `${os.homedir()}/.local/bin/post-installx/post-${x.listKey}.sh` const scriptExists = fs.existsSync(scriptPath) if (!scriptExists) return Promise.resolve() log(`Running post-install script defined in ${scriptPath}`) return runScript(`post-${x.listKey}.sh`, fs.readFileSync(scriptPath, 'utf8')) }) - await Promise.allSettled(...postScripts, ...postScriptFiles) + await Promise.allSettled(postScripts.concat(postScriptFiles)) log(`Starting services flagged with _serviceEnabled`) const systemctlInstalled = which.sync('systemctl', { nothrow: true }) const brewInstalled = which.sync('brew', { nothrow: true }) const servicePromises = installData - .filter(x => x._serviceEnabled) - .filter(x => x._service) + .filter(x => !!x._serviceEnabled) + .filter(x => !!x._service) .flatMap(x => { const serviceField = getPkgData('_service', x, x.installType) if (!serviceField) return Promise.resolve() diff --git a/home/dot_local/bin/post-installx/executable_post-brave-browser.sh b/home/dot_local/bin/post-installx/executable_post-brave-browser.sh deleted file mode 100644 index 7b32fda3..00000000 --- a/home/dot_local/bin/post-installx/executable_post-brave-browser.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash -# @file Brave Browser Setup -# @brief Applies browser policy configurations - -function chromeSetUp() { - ### Ensure Chrome policies directory is present - logg info 'Processing policy directories for Chromium based browsers' - for POLICY_DIR in "/etc/brave/policies"; do - if [ -d "$(dirname "$POLICY_DIR")" ]; then - ### Managed policies - if [ ! -f "$POLICY_DIR/managed/policies.json" ]; then - logg info "Ensuring directory $POLICY_DIR/managed exists" - sudo mkdir -p "$POLICY_DIR/managed" - logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json to $POLICY_DIR/managed/policies.json" - sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json" "$POLICY_DIR/managed/policies.json" - fi - - ### Recommended policies - if [ ! -f "$POLICY_DIR/recommended/policies.json" ]; then - logg info "Ensuring directory $POLICY_DIR/recommended exists" && sudo mkdir -p "$POLICY_DIR/recommended" - logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json to $POLICY_DIR/recommended/policies.json" - sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json" "$POLICY_DIR/recommended/policies.json" - fi - else - logg info "Skipping extension injection into $POLICY_DIR - create these folders prior to running to create managed configs" - fi - done - ### Add Chrome extension JSON - # logg info 'Populating Chrome extension JSON' - # for EXTENSION_DIR in "/etc/brave/extensions" "$HOME/Library/Application Support/BraveSoftware/Brave-Browser/External Extensions"; do - # ### Ensure program-type is installed - # if [ -d "$(dirname "$EXTENSION_DIR")" ]; then - # ### Ensure extension directory exists - # if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then - # if [ ! -d "$EXTENSION_DIR" ]; then - # logg info "Creating directory $EXTENSION_DIR" && sudo mkdir -p "$EXTENSION_DIR" - # fi - # else - # if [ ! -d "$EXTENSION_DIR" ]; then - # logg info "Creating directory $EXTENSION_DIR" && mkdir -p "$EXTENSION_DIR" - # fi - # fi - # ### Add extension JSON - # logg info "Adding Chrome extensions to $EXTENSION_DIR" - # for EXTENSION in { { list (.chromeExtensions | toString | replace "[" "" | replace "]" "") | uniq | join " " } }; do - # logg info "Adding Chrome extension manifest ($EXTENSION)" - # if ! echo "$EXTENSION" | grep 'https://chrome.google.com/webstore/detail/' > /dev/null; then - # EXTENSION="https://chrome.google.com/webstore/detail/$EXTENSION" - # fi - # EXTENSION_ID="$(echo "$EXTENSION" | sed 's/^.*\/\([^\/]*\)$/\1/')" - # if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then - # sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" - # else - # cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" - # fi - # done - # else - # logg info "$EXTENSION_DIR does not exist" - # fi - # done -} - -chromeSetUp diff --git a/home/dot_local/bin/post-installx/executable_post-chromium.sh b/home/dot_local/bin/post-installx/executable_post-chromium.sh deleted file mode 100644 index f9c38861..00000000 --- a/home/dot_local/bin/post-installx/executable_post-chromium.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -# @file Chromium Configuration -# @brief Applies browser policy configurations - -function chromeSetUp() { - ### Ensure Chrome policies directory is present - logg info 'Processing policy directories for Chromium based browsers' - for POLICY_DIR in "/etc/chromium/policies"; do - if [ -d "$(dirname "$POLICY_DIR")" ]; then - ### Managed policies - if [ ! -f "$POLICY_DIR/managed/policies.json" ]; then - logg info "Ensuring directory $POLICY_DIR/managed exists" - sudo mkdir -p "$POLICY_DIR/managed" - logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json to $POLICY_DIR/managed/policies.json" - sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json" "$POLICY_DIR/managed/policies.json" - fi - - ### Recommended policies - if [ ! -f "$POLICY_DIR/recommended/policies.json" ]; then - logg info "Ensuring directory $POLICY_DIR/recommended exists" && sudo mkdir -p "$POLICY_DIR/recommended" - logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json to $POLICY_DIR/recommended/policies.json" - sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json" "$POLICY_DIR/recommended/policies.json" - fi - else - logg info "Skipping extension injection into $POLICY_DIR - create these folders prior to running to create managed configs" - fi - done - - # ### Add Chrome extension JSON - # logg info 'Populating Chrome extension JSON' - # ### TODO - Find `EXTENSION_DIR` for macOS in Application Support folder like `$HOME/Library/Application Support/Google/Chrome/External Extensions` for Google Chrome - # for EXTENSION_DIR in "/etc/chromium/extensions"; do - # ### Ensure program-type is installed - # if [ -d "$(dirname "$EXTENSION_DIR")" ]; then - # ### Ensure extension directory exists - # if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then - # if [ ! -d "$EXTENSION_DIR" ]; then - # logg info "Creating directory $EXTENSION_DIR" && sudo mkdir -p "$EXTENSION_DIR" - # fi - # else - # if [ ! -d "$EXTENSION_DIR" ]; then - # logg info "Creating directory $EXTENSION_DIR" && mkdir -p "$EXTENSION_DIR" - # fi - # fi - # ### Add extension JSON - # logg info "Adding Chrome extensions to $EXTENSION_DIR" - # for EXTENSION in {{ list (.chromeExtensions | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do - # logg info "Adding Chrome extension manifest ($EXTENSION)" - # if ! echo "$EXTENSION" | grep 'https://chrome.google.com/webstore/detail/' > /dev/null; then - # EXTENSION="https://chrome.google.com/webstore/detail/$EXTENSION" - # fi - # EXTENSION_ID="$(echo "$EXTENSION" | sed 's/^.*\/\([^\/]*\)$/\1/')" - # if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then - # sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" - # else - # cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" - # fi - # done - # else - # logg info "$EXTENSION_DIR does not exist" - # fi - # done -} - -chromeSetUp diff --git a/home/dot_local/bin/post-installx/executable_post-microsoft-edge.sh b/home/dot_local/bin/post-installx/executable_post-microsoft-edge.sh deleted file mode 100644 index c82edbe4..00000000 --- a/home/dot_local/bin/post-installx/executable_post-microsoft-edge.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -# @file Microsoft Edge Extensions -# @brief See ~/.local/bin/installx/post-google-chrome.sh for more details - -function chromeSetUp() { - ### Ensure Chrome policies directory is present - # logg info 'Processing policy directories for Chromium based browsers' - ### TODO - Find POLICY_DIR location for Microsoft Edge - # for POLICY_DIR in "/opt/google/chrome/policies" "/etc/chromium/policies" "/etc/brave/policies"; do - # if [ -d "$(dirname "$POLICY_DIR")" ]; then - # ### Managed policies - # if [ ! -f "$POLICY_DIR/managed/policies.json" ]; then - # logg info "Ensuring directory $POLICY_DIR/managed exists" - # sudo mkdir -p "$POLICY_DIR/managed" - # logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json to $POLICY_DIR/managed/policies.json" - # sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/managed.json" "$POLICY_DIR/managed/policies.json" - # fi - # ### Recommended policies - # if [ ! -f "$POLICY_DIR/recommended/policies.json" ]; then - # logg info "Ensuring directory $POLICY_DIR/recommended exists" && sudo mkdir -p "$POLICY_DIR/recommended" - # logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json to $POLICY_DIR/recommended/policies.json" - # sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/recommended.json" "$POLICY_DIR/recommended/policies.json" - # fi - # else - # logg info "Skipping extension injection into $POLICY_DIR - create these folders prior to running to create managed configs" - # fi - # done - - ### Add Chrome extension JSON - logg info 'Populating Chrome extension JSON' - for EXTENSION_DIR in "$HOME/Library/Application Support/Microsoft/Edge/External Extensions"; do - ### Ensure program-type is installed - if [ -d "$(dirname "$EXTENSION_DIR")" ]; then - ### Ensure extension directory exists - if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then - if [ ! -d "$EXTENSION_DIR" ]; then - logg info "Creating directory $EXTENSION_DIR" && sudo mkdir -p "$EXTENSION_DIR" - fi - else - if [ ! -d "$EXTENSION_DIR" ]; then - logg info "Creating directory $EXTENSION_DIR" && mkdir -p "$EXTENSION_DIR" - fi - fi - ### Add extension JSON - logg info "Adding Chrome extensions to $EXTENSION_DIR" - for EXTENSION in {{ list (.chromeExtensions | toString | replace "[" "" | replace "]" "") | uniq | join " " }}; do - logg info "Adding Chrome extension manifest ($EXTENSION)" - if ! echo "$EXTENSION" | grep 'https://chrome.google.com/webstore/detail/' > /dev/null; then - EXTENSION="https://chrome.google.com/webstore/detail/$EXTENSION" - fi - EXTENSION_ID="$(echo "$EXTENSION" | sed 's/^.*\/\([^\/]*\)$/\1/')" - if [[ "$EXTENSION_DIR" == '/opt/'* ]] || [[ "$EXTENSION_DIR" == '/etc/'* ]]; then - sudo cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" - else - cp -f "${XDG_CONFIG_HOME:-$HOME/.config}/chrome/extension.json" "$EXTENSION_DIR/${EXTENSION_ID}.json" - fi - done - else - logg info "$EXTENSION_DIR does not exist" - fi - done -} - -chromeSetUp diff --git a/home/dot_zshrc b/home/dot_zshrc index 5ed52276..2cfdbe43 100644 --- a/home/dot_zshrc +++ b/home/dot_zshrc @@ -438,6 +438,7 @@ fi [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/goto.sh" ] || source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/goto.sh" ### hiSHtory +# Hishtory Config: export PATH="$PATH:${XDG_CONFIG_HOME:-$HOME/.config}/hishtory" [ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.zsh" ] || source "${XDG_CONFIG_HOME:-$HOME/.config}/hishtory/config.zsh" diff --git a/software.yml b/software.yml index 1e7c3328..aa4289d9 100644 --- a/software.yml +++ b/software.yml @@ -4701,6 +4701,7 @@ softwarePackages: scoop: himalaya hishtory: _bin: hishtory + _deprecated: Superior to other history managers but the software has some odd features to it like automatically managing ~/.bashrc and ~/.zshrc and `which hishtory` links to a non-existant location but it still works _desc: "hishtory is a tool available on GitHub at https://github.com/ddworken/hishtory. It appears to be a project related to browsing history analysis. The tool likely allows users to analyze and visualize \ntheir browsing history data, providing insights into their online activities. For more detailed information, you can explore the repository on GitHub. " _github: https://github.com/ddworken/hishtory _name: hiSHtory