Latest
This commit is contained in:
parent
0c2c17b8ab
commit
37f9beeff8
21 changed files with 796 additions and 394 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
||||||
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/opt/homebrew/bin:$HOME/.local/bin
|
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/opt/homebrew/bin:$HOME/.local/bin
|
||||||
|
|
||||||
*/5 * * * * command -v autorestic > /dev/null && . "$HOME/.config/shell/apps.sh" && autorestic -c "$HOME/.config/autorestic/autorestic-user.yml" --ci cron > /tmp/autorestic.log 2>&1
|
*/5 * * * * command -v autorestic > /dev/null && autorestic -c "$HOME/.config/autorestic/autorestic-user.yml" --ci cron > /tmp/autorestic.log 2>&1
|
||||||
* * * * * command -v dagu-cron > /dev/null && dagu-cron
|
* * * * * command -v dagu-start-all > /dev/null && test -f "$HOME/.config/shell/exports.sh" && . "$HOME/.config/shell/exports.sh" && dagu-start-all
|
||||||
30 4 * * * command -v ghorg > /dev/null && ghorg reclone
|
30 4 * * * command -v ghorg > /dev/null && test -f "$HOME/.config/shell/exports.sh" && . "$HOME/.config/shell/exports.sh" && ghorg reclone
|
||||||
|
|
||||||
# * * * * * command to be executed
|
# * * * * * command to be executed
|
||||||
# ┯ ┯ ┯ ┯ ┯
|
# ┯ ┯ ┯ ┯ ┯
|
||||||
|
|
|
@ -36,6 +36,11 @@ elif command -v htop > /dev/null; then
|
||||||
alias top='bashtop'
|
alias top='bashtop'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### batcat
|
||||||
|
if command -v batcat > /dev/null; then
|
||||||
|
alias bat='batcat'
|
||||||
|
fi
|
||||||
|
|
||||||
### bat
|
### bat
|
||||||
if command -v bat > /dev/null; then
|
if command -v bat > /dev/null; then
|
||||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
@ -43,7 +48,7 @@ if command -v bat > /dev/null; then
|
||||||
alias cat='bat -pp'
|
alias cat='bat -pp'
|
||||||
alias less='bat --paging=always'
|
alias less='bat --paging=always'
|
||||||
help() {
|
help() {
|
||||||
"$@" --help 2>&1 | bathelp
|
"$@" --help 2>&1 | bat-help
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -70,6 +75,11 @@ else
|
||||||
alias ls='ls -AlhF --color=auto'
|
alias ls='ls -AlhF --color=auto'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### fdfind
|
||||||
|
if command -v fdfind > /dev/null; then
|
||||||
|
alias fd='fdfind'
|
||||||
|
fi
|
||||||
|
|
||||||
### gping
|
### gping
|
||||||
# Replacement for ping that includes graph
|
# Replacement for ping that includes graph
|
||||||
if command -v gping > /dev/null; then
|
if command -v gping > /dev/null; then
|
||||||
|
@ -101,6 +111,11 @@ if command -v mitmweb > /dev/null; then
|
||||||
alias mitmweb='mitmweb --set confdir=${XDG_CONFIG_HOME:-$HOME/.config}/mitmproxy'
|
alias mitmweb='mitmweb --set confdir=${XDG_CONFIG_HOME:-$HOME/.config}/mitmproxy'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
### readlink
|
||||||
|
if command -v greadlink > /dev/null && [ -d /Applications ] && [ -d /System ]; then
|
||||||
|
alias readlink='greadlink'
|
||||||
|
fi
|
||||||
|
|
||||||
### ripgrep
|
### ripgrep
|
||||||
if command -v rg > /dev/null; then
|
if command -v rg > /dev/null; then
|
||||||
alias rgrep='rg --color=auto'
|
alias rgrep='rg --color=auto'
|
||||||
|
@ -109,6 +124,11 @@ fi
|
||||||
### xclip
|
### xclip
|
||||||
alias xclip='xclip -selection c'
|
alias xclip='xclip -selection c'
|
||||||
|
|
||||||
|
### yank
|
||||||
|
if command -v yank-cli > /dev/null; then
|
||||||
|
alias yank='yank-cli'
|
||||||
|
fi
|
||||||
|
|
||||||
### Zola
|
### Zola
|
||||||
if command -v org.getzola.zola > /dev/null; then
|
if command -v org.getzola.zola > /dev/null; then
|
||||||
alias zola="flatpak run org.getzola.zola"
|
alias zola="flatpak run org.getzola.zola"
|
||||||
|
|
|
@ -55,6 +55,9 @@ export PATH="$HOME/.local/bin/firejail:$PATH"
|
||||||
export PATH="$HOME/.local/bin/flatpak:$PATH"
|
export PATH="$HOME/.local/bin/flatpak:$PATH"
|
||||||
export PATH="$HOME/.local/bin/gpt:$PATH"
|
export PATH="$HOME/.local/bin/gpt:$PATH"
|
||||||
export PATH="$HOME/.local/bin/pipx:$PATH"
|
export PATH="$HOME/.local/bin/pipx:$PATH"
|
||||||
|
if [ -f /usr/bin/qubes-session ]; then
|
||||||
|
export PATH="$HOME/.local/bin/qubes:$PATH"
|
||||||
|
fi
|
||||||
export SSH_KEY_PATH="$HOME/.ssh/id_rsa"
|
export SSH_KEY_PATH="$HOME/.ssh/id_rsa"
|
||||||
|
|
||||||
### Homebrew
|
### Homebrew
|
||||||
|
@ -112,6 +115,9 @@ fi
|
||||||
export ANSIBLE_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/ansible"
|
export ANSIBLE_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/ansible"
|
||||||
export ANSIBLE_CONFIG="$ANSIBLE_HOME/ansible.cfg"
|
export ANSIBLE_CONFIG="$ANSIBLE_HOME/ansible.cfg"
|
||||||
export ANSIBLE_GALAXY_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ansible/galaxy_cache"
|
export ANSIBLE_GALAXY_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ansible/galaxy_cache"
|
||||||
|
if [ -f /usr/bin/qubes-session ]; then
|
||||||
|
export PATH="$PATH:$HOME/.local/share/ansible-qubes/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
### Aqua
|
### Aqua
|
||||||
export AQUA_ROOT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/aqua"
|
export AQUA_ROOT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/aqua"
|
||||||
|
@ -278,6 +284,14 @@ export HOMEBREW_CASK_OPTS="--appdir=/Applications --display-times --no-quarantin
|
||||||
### HTTPie
|
### HTTPie
|
||||||
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/httpie"
|
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/httpie"
|
||||||
|
|
||||||
|
### IntelliJ IDEA
|
||||||
|
if [ -f "/Applications/IntelliJ IDEA CE.app/Contents/MacOS/idea" ]; then
|
||||||
|
export PATH="$PATH:/Applications/IntelliJ IDEA CE.app/Contents/MacOS"
|
||||||
|
alias idea.sh='idea'
|
||||||
|
elif [ -f "/snap/intellij-idea-community/current/bin/idea.sh" ]; then
|
||||||
|
export PATH="$PATH:/snap/intellij-idea-community/current/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
### IPFS
|
### IPFS
|
||||||
export IPFS_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/ipfs"
|
export IPFS_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/ipfs"
|
||||||
|
|
||||||
|
|
|
@ -2,30 +2,30 @@
|
||||||
# @file ~/.local/bin/add-usergroup
|
# @file ~/.local/bin/add-usergroup
|
||||||
# @brief Add a user and a group with the same name on either Linux or macOS
|
# @brief Add a user and a group with the same name on either Linux or macOS
|
||||||
# @description
|
# @description
|
||||||
# This script is utilized by other scripts to ensure that there is both a user and group
|
# This script is utilized by other scripts to ensure that there is both a user and group
|
||||||
# named by the single argument that this executable accepts. It checks whether or not
|
# named by the single argument that this executable accepts. It checks whether or not
|
||||||
# there is already a user / group with the name present on the system before running
|
# there is already a user / group with the name present on the system before running
|
||||||
# any code. On macOS, it assigns the user an ID that equal to the maximum user ID present
|
# any code. On macOS, it assigns the user an ID that equal to the maximum user ID present
|
||||||
# on the system plus one.
|
# on the system plus one.
|
||||||
|
|
||||||
# Check if the script is being run as root
|
# Check if the script is being run as root
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg error "This script must be run as root"
|
logg error "This script must be run as root"
|
||||||
else
|
else
|
||||||
echo -e "\e[91mThis script must be run as root\e[0m"
|
echo -e "\e[91mThis script must be run as root\e[0m"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the correct number of arguments is provided
|
# Check if the correct number of arguments is provided
|
||||||
if [[ $# -ne 2 ]]; then
|
if [[ $# -ne 2 ]]; then
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg info "Usage: $0 <user> <group>"
|
logg info "Usage: $0 <user> <group>"
|
||||||
else
|
else
|
||||||
echo -e "\e[93mUsage: $0 <user> <group>\e[0m"
|
echo -e "\e[93mUsage: $0 <user> <group>\e[0m"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
USER=$1
|
USER=$1
|
||||||
|
@ -33,89 +33,89 @@ GROUP=$2
|
||||||
|
|
||||||
# Check if the operating system is macOS
|
# Check if the operating system is macOS
|
||||||
if [ -d /Applications ] && [ -d /System ]; then
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg info "Creating group and user ${GROUP} on macOS..."
|
logg info "Creating group and user ${GROUP} on macOS..."
|
||||||
else
|
else
|
||||||
echo -e "\e[96mCreating group and user ${GROUP} on macOS...\e[0m"
|
echo -e "\e[96mCreating group and user ${GROUP} on macOS...\e[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure group exists
|
# Ensure group exists
|
||||||
if ! dscl . read "/Groups/$GROUP" gid &> /dev/null; then
|
if ! dscl . read "/Groups/$GROUP" gid &> /dev/null; then
|
||||||
MAX_ID_GROUP="$(dscl . -list /Groups gid | awk '{print $2}' | sort -ug | tail -1)"
|
MAX_ID_GROUP="$(dscl . -list /Groups gid | awk '{print $2}' | sort -ug | tail -1)"
|
||||||
PRIMARY_GROUP_ID="$((MAX_ID_GROUP+1))"
|
PRIMARY_GROUP_ID="$((MAX_ID_GROUP+1))"
|
||||||
dscl . create "/Groups/$GROUP"
|
dscl . create "/Groups/$GROUP"
|
||||||
# This also sets the PrimaryGroupID
|
# This also sets the PrimaryGroupID
|
||||||
sudo dscl . create "/Groups/$GROUP" gid "$PRIMARY_GROUP_ID"
|
sudo dscl . create "/Groups/$GROUP" gid "$PRIMARY_GROUP_ID"
|
||||||
sudo dscl . append "/Groups/$GROUP" GroupMembership "$USER"
|
sudo dscl . append "/Groups/$GROUP" GroupMembership "$USER"
|
||||||
else
|
else
|
||||||
PRIMARY_GROUP_ID="$(dscl . read "/Groups/$GROUP" gid | awk '{print $2}')"
|
PRIMARY_GROUP_ID="$(dscl . read "/Groups/$GROUP" gid | awk '{print $2}')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure user exists
|
# Ensure user exists
|
||||||
if ! dscl . read "/Users/$GROUP" UniqueID &> /dev/null; then
|
if ! dscl . read "/Users/$GROUP" UniqueID &> /dev/null; then
|
||||||
MAX_ID_USER="$(dscl . -list /Users UniqueID | sort -nr -k 2 | head -1 | grep -oE "[0-9]+$")"
|
MAX_ID_USER="$(dscl . -list /Users UniqueID | sort -nr -k 2 | head -1 | grep -oE "[0-9]+$")"
|
||||||
UNIQUE_ID="$((MAX_ID_USER+1))"
|
UNIQUE_ID="$((MAX_ID_USER+1))"
|
||||||
sudo dscl . create "/Users/$GROUP"
|
sudo dscl . create "/Users/$GROUP"
|
||||||
sudo dscl . create "/Users/$GROUP" UniqueID "$UNIQUE_ID"
|
sudo dscl . create "/Users/$GROUP" UniqueID "$UNIQUE_ID"
|
||||||
sudo dscl . create "/Users/$GROUP" PrimaryGroupID "$PRIMARY_GROUP_ID"
|
sudo dscl . create "/Users/$GROUP" PrimaryGroupID "$PRIMARY_GROUP_ID"
|
||||||
else
|
else
|
||||||
UNIQUE_ID="$(dscl . read "/Users/$GROUP" UniqueID | awk '{print $2}')"
|
UNIQUE_ID="$(dscl . read "/Users/$GROUP" UniqueID | awk '{print $2}')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add the user to the group
|
# Add the user to the group
|
||||||
sudo dseditgroup -o edit -t user -a "$GROUP" "$GROUP"
|
sudo dseditgroup -o edit -t user -a "$GROUP" "$GROUP"
|
||||||
# Add the current user to the group
|
# Add the current user to the group
|
||||||
sudo dseditgroup -o edit -t user -a "$USER" "$GROUP"
|
sudo dseditgroup -o edit -t user -a "$USER" "$GROUP"
|
||||||
# Add USER group to the group
|
# Add USER group to the group
|
||||||
sudo dseditgroup -o edit -t group -a "$USER" "$GROUP"
|
sudo dseditgroup -o edit -t group -a "$USER" "$GROUP"
|
||||||
|
|
||||||
|
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg info "Group and user ${GROUP} created successfully on macOS"
|
logg info "Group and user ${GROUP} created successfully on macOS"
|
||||||
else
|
else
|
||||||
echo -e "\e[92mGroup and user ${GROUP} created successfully on macOS\e[0m"
|
echo -e "\e[92mGroup and user ${GROUP} created successfully on macOS\e[0m"
|
||||||
fi
|
fi
|
||||||
elif [[ "$(uname)" == "Linux" ]]; then
|
elif [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
if command -v logg > /dev/null; then
|
||||||
|
logg info "Creating group and user ${GROUP} on Linux..."
|
||||||
|
else
|
||||||
|
echo -e "\e[96mCreating group and user ${GROUP} on Linux...\e[0m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the group already exists
|
||||||
|
if ! grep -qE "^${GROUP}:" /etc/group; then
|
||||||
|
# Create the group
|
||||||
|
groupadd "${GROUP}"
|
||||||
|
else
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg info "Creating group and user ${GROUP} on Linux..."
|
logg info "Group ${GROUP} already exists"
|
||||||
else
|
else
|
||||||
echo -e "\e[96mCreating group and user ${GROUP} on Linux...\e[0m"
|
echo -e "\e[93mGroup ${GROUP} already exists\e[0m"
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the group already exists
|
|
||||||
if ! grep -qE "^${GROUP}:" /etc/group; then
|
|
||||||
# Create the group
|
|
||||||
groupadd "${GROUP}"
|
|
||||||
else
|
|
||||||
if command -v logg > /dev/null; then
|
|
||||||
logg info "Group ${GROUP} already exists"
|
|
||||||
else
|
|
||||||
echo -e "\e[93mGroup ${GROUP} already exists\e[0m"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the user already exists
|
|
||||||
if ! id -u "${GROUP}" >/dev/null 2>&1; then
|
|
||||||
# Create the user and assign it to the group
|
|
||||||
useradd -g "${GROUP}" "${GROUP}"
|
|
||||||
else
|
|
||||||
if command -v logg > /dev/null; then
|
|
||||||
logg info "User ${GROUP} already exists"
|
|
||||||
else
|
|
||||||
echo -e "\e[93mUser ${GROUP} already exists\e[0m"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if the user already exists
|
||||||
|
if ! id -u "${GROUP}" >/dev/null 2>&1; then
|
||||||
|
# Create the user and assign it to the group
|
||||||
|
useradd -g "${GROUP}" "${GROUP}"
|
||||||
|
else
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg success "Group and user ${GROUP} created successfully on Linux"
|
logg info "User ${GROUP} already exists"
|
||||||
else
|
else
|
||||||
echo -e "\e[92mGroup and user ${GROUP} created successfully on Linux\e[0m"
|
echo -e "\e[93mUser ${GROUP} already exists\e[0m"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v logg > /dev/null; then
|
||||||
|
logg success "Group and user ${GROUP} created successfully on Linux"
|
||||||
|
else
|
||||||
|
echo -e "\e[92mGroup and user ${GROUP} created successfully on Linux\e[0m"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the operating system is neither macOS nor Linux, display an error message
|
# If the operating system is neither macOS nor Linux, display an error message
|
||||||
if command -v logg > /dev/null; then
|
if command -v logg > /dev/null; then
|
||||||
logg error "Unsupported operating system"
|
logg error "Unsupported operating system"
|
||||||
else
|
else
|
||||||
echo -e "\e[91mUnsupported operating system\e[0m"
|
echo -e "\e[91mUnsupported operating system\e[0m"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
backupMacPrefs() {
|
backupMacPrefs() {
|
||||||
if [ -d /Applications ] && [ -d /System ]; then
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
if command -v macprefs > /dev/null; then
|
if command -v macprefs > /dev/null; then
|
||||||
logg info 'Backing up macOS preferences with macprefs'
|
logg info 'Backing up macOS preferences with macprefs'
|
||||||
macprefs backup -t system_preferences startup_items shared_file_lists app_store_preferences internet_accounts
|
macprefs backup -t system_preferences startup_items shared_file_lists app_store_preferences internet_accounts
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
backupMacPrefs
|
backupMacPrefs
|
||||||
|
|
|
@ -17,22 +17,22 @@
|
||||||
{{ includeTemplate "universal/logg" }}
|
{{ includeTemplate "universal/logg" }}
|
||||||
|
|
||||||
if command -v mackup > /dev/null; then
|
if command -v mackup > /dev/null; then
|
||||||
### Create symlinks pointing to stored configurations
|
### Create symlinks pointing to stored configurations
|
||||||
logg info 'Symlinking ~/.mackup and ~/.mackup.cfg'
|
logg info 'Symlinking ~/.mackup and ~/.mackup.cfg'
|
||||||
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup/" ~/.mackup
|
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup/" ~/.mackup
|
||||||
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup.cfg" ~/.mackup.cfg
|
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/mackup/.mackup.cfg" ~/.mackup.cfg
|
||||||
|
|
||||||
### Run mackup
|
### Run mackup
|
||||||
logg info 'Running mackup'
|
logg info 'Running mackup'
|
||||||
mackup $* || echo ''
|
mackup $* || echo ''
|
||||||
|
|
||||||
### Remove temporary configuration files
|
### Remove temporary configuration files
|
||||||
logg info 'Removing symlinked ~/.mackup and ~/.mackup.cfg configurations'
|
logg info 'Removing symlinked ~/.mackup and ~/.mackup.cfg configurations'
|
||||||
rm -f ~/.mackup
|
rm -f ~/.mackup
|
||||||
rm -f ~/.mackup.cfg
|
rm -f ~/.mackup.cfg
|
||||||
|
|
||||||
### Print success message
|
### Print success message
|
||||||
logg success 'Successfully ran backup-apps'
|
logg success 'Successfully ran backup-apps'
|
||||||
else
|
else
|
||||||
logg error 'mackup is not installed' && exit 1
|
logg error 'mackup is not installed' && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
### Create backups
|
### Create backups
|
||||||
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" ]; then
|
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" ]; then
|
||||||
DCONF_TMP="$(mktemp)"
|
DCONF_TMP="$(mktemp)"
|
||||||
logg info 'Moving ~/.config/dconf/settings to '"$DCONF_TMP"
|
logg info 'Moving ~/.config/dconf/settings to '"$DCONF_TMP"
|
||||||
cp -rf "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" "$DCONF_TMP"
|
cp -rf "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" "$DCONF_TMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Ensure ~/.config/dconf/settings exists
|
### Ensure ~/.config/dconf/settings exists
|
||||||
|
@ -16,12 +16,12 @@ mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings"
|
||||||
|
|
||||||
### Overwrite ~/.config/dconf/settings configurations so we can diff with Chezmoi
|
### Overwrite ~/.config/dconf/settings configurations so we can diff with Chezmoi
|
||||||
find "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
|
find "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
|
||||||
DCONF_SETTINGS_ID="/$(basename "$DCONF_CONFIG_FILE" | sed 's/\./\//g')/"
|
DCONF_SETTINGS_ID="/$(basename "$DCONF_CONFIG_FILE" | sed 's/\./\//g')/"
|
||||||
logg info 'Dumping '"$DCONF_SETTINGS_ID"' to '"$DCONF_CONFIG_FILE"
|
logg info 'Dumping '"$DCONF_SETTINGS_ID"' to '"$DCONF_CONFIG_FILE"
|
||||||
dconf dump "$DCONF_SETTINGS_ID" > "$DCONF_CONFIG_FILE"
|
dconf dump "$DCONF_SETTINGS_ID" > "$DCONF_CONFIG_FILE"
|
||||||
logg success 'Saved new configuration to '"$DCONF_CONFIG_FILE"
|
logg success 'Saved new configuration to '"$DCONF_CONFIG_FILE"
|
||||||
logg info 'Printing diff for '"$DCONF_CONFIG_FILE"
|
logg info 'Printing diff for '"$DCONF_CONFIG_FILE"
|
||||||
chezmoi diff "$DCONF_CONFIG_FILE" || true
|
chezmoi diff "$DCONF_CONFIG_FILE" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
|
@ -2,52 +2,52 @@
|
||||||
# @file .local/bin/gitomatic-service
|
# @file .local/bin/gitomatic-service
|
||||||
# @brief Helper script to run gitomatic to monitor git repositories
|
# @brief Helper script to run gitomatic to monitor git repositories
|
||||||
# @description
|
# @description
|
||||||
# This script is executed by gitomatic systemd service. `gitomatic` does not support monitoring multiple
|
# This script is executed by gitomatic systemd service. `gitomatic` does not support monitoring multiple
|
||||||
# repositories in a single process. This script starts as many gitomatic processes as there are repositories.
|
# repositories in a single process. This script starts as many gitomatic processes as there are repositories.
|
||||||
#
|
#
|
||||||
# This feature allows you to specify git repositories and corresponding paths to keep in-sync, using both git
|
# This feature allows you to specify git repositories and corresponding paths to keep in-sync, using both git
|
||||||
# push and pull.
|
# push and pull.
|
||||||
#
|
#
|
||||||
# ## Links
|
# ## Links
|
||||||
#
|
#
|
||||||
# [Systemd Unit file](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/gitomatic/gitomatic.service.tmpl)
|
# [Systemd Unit file](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/gitomatic/gitomatic.service.tmpl)
|
||||||
|
|
||||||
if command -v gitomatic > /dev/null && command -v jq > /dev/null && command -v yq > /dev/null && command -v git > /dev/null; then
|
if command -v gitomatic > /dev/null && command -v jq > /dev/null && command -v yq > /dev/null && command -v git > /dev/null; then
|
||||||
if [ -d /Applications ] && [ -d /System ]; then
|
if [ -d /Applications ] && [ -d /System ]; then
|
||||||
USER_FOLDER="/Users"
|
USER_FOLDER="/Users"
|
||||||
else
|
else
|
||||||
USER_FOLDER="/home"
|
USER_FOLDER="/home"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Cycle through user folder chezmoi.yaml configurations
|
### Cycle through user folder chezmoi.yaml configurations
|
||||||
while read FOLDER; do
|
while read FOLDER; do
|
||||||
USER_FROM_FOLDER="$(echo "$FOLDER" | sed 's/\/\(.*\)$/\1/')"
|
USER_FROM_FOLDER="$(echo "$FOLDER" | sed 's/\/\(.*\)$/\1/')"
|
||||||
CHEZMOI_YAML="$USER_FOLDER/$USER_FROM_FOLDER/.config/chezmoi/chezmoi.yaml"
|
CHEZMOI_YAML="$USER_FOLDER/$USER_FROM_FOLDER/.config/chezmoi/chezmoi.yaml"
|
||||||
if [ -f "$CHEZMOI_YAML" ]; then
|
if [ -f "$CHEZMOI_YAML" ]; then
|
||||||
for IM in $(yq eval -o=j "$CHEZMOI_YAML" | jq -cr '.data.user.gitomatic[]'); do
|
for IM in $(yq eval -o=j "$CHEZMOI_YAML" | jq -cr '.data.user.gitomatic[]'); do
|
||||||
GIT="$(echo "$IM" | jq -r '.git' -)"
|
GIT="$(echo "$IM" | jq -r '.git' -)"
|
||||||
GIT_PATH="$(echo "$IM" | jq -r '.path' -)"
|
GIT_PATH="$(echo "$IM" | jq -r '.path' -)"
|
||||||
if [ ! -d "$GIT_PATH" ]; then
|
if [ ! -d "$GIT_PATH" ]; then
|
||||||
sudo su - "$USER_FROM_FOLDER" -c 'git clone "$GIT" "$GIT_PATH"'
|
sudo su - "$USER_FROM_FOLDER" -c 'git clone "$GIT" "$GIT_PATH"'
|
||||||
fi
|
|
||||||
cd "$GIT_PATH"
|
|
||||||
sudo su - "$USER_FROM_FOLDER" -c 'gitomatic -email "$(git config user.email)" "$GIT_PATH" &'
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
done < <(find "$USER_FOLDER" -mindepth 1 -maxdepth 1 -type d)
|
cd "$GIT_PATH"
|
||||||
|
sudo su - "$USER_FROM_FOLDER" -c 'gitomatic -email "$(git config user.email)" "$GIT_PATH" &'
|
||||||
### Handle root user config
|
done
|
||||||
if [ -f /root/.config/chezmoi/chezmoi.yaml ]; then
|
|
||||||
for IM in $(yq eval -o=j /root/.config/chezmoi.chezmoi.yaml | jq -cr '.data.user.gitomatic[]'); do
|
|
||||||
GIT="$(echo "$IM" | jq -r '.git' -)"
|
|
||||||
GIT_PATH="$(echo "$IM" | jq -r '.path' -)"
|
|
||||||
if [ ! -d "$GIT_PATH" ]; then
|
|
||||||
git clone "$GIT" "$GIT_PATH"
|
|
||||||
fi
|
|
||||||
cd "$GIT_PATH"
|
|
||||||
gitomatic -email "$(git config user.email)" "$GIT_PATH" &
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
done < <(find "$USER_FOLDER" -mindepth 1 -maxdepth 1 -type d)
|
||||||
|
|
||||||
|
### Handle root user config
|
||||||
|
if [ -f /root/.config/chezmoi/chezmoi.yaml ]; then
|
||||||
|
for IM in $(yq eval -o=j /root/.config/chezmoi.chezmoi.yaml | jq -cr '.data.user.gitomatic[]'); do
|
||||||
|
GIT="$(echo "$IM" | jq -r '.git' -)"
|
||||||
|
GIT_PATH="$(echo "$IM" | jq -r '.path' -)"
|
||||||
|
if [ ! -d "$GIT_PATH" ]; then
|
||||||
|
git clone "$GIT" "$GIT_PATH"
|
||||||
|
fi
|
||||||
|
cd "$GIT_PATH"
|
||||||
|
gitomatic -email "$(git config user.email)" "$GIT_PATH" &
|
||||||
|
done
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo 'gitomatic, jq, yq, and git should be installed!' && exit 1
|
echo 'gitomatic, jq, yq, and git should be installed!' && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{{- if eq .host.qubes true -}}
|
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Creates a Qube on RAM disk and opens Firefox if the Qube does not already exist.
|
# Creates a Qube on RAM disk and opens Firefox if the Qube does not already exist.
|
||||||
|
@ -27,4 +26,3 @@ else
|
||||||
sudo rm -rf /var/log/pacat.new.log
|
sudo rm -rf /var/log/pacat.new.log
|
||||||
sudo rm -rf /var/log/qubesdb.new.log
|
sudo rm -rf /var/log/qubesdb.new.log
|
||||||
fi
|
fi
|
||||||
{{ end -}}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.distro.id "ubuntu") -}}
|
|
||||||
/usr/bin/batcat
|
|
||||||
{{- end -}}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.qubes true) -}}
|
|
||||||
{{ .host.home }}/.local/share/ansible-qubes/bin/bombshell-client
|
|
||||||
{{- end -}}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.distro.id "ubuntu") -}}
|
|
||||||
/usr/bin/fdfind
|
|
||||||
{{- end -}}
|
|
|
@ -1,5 +0,0 @@
|
||||||
{{- if (eq .host.distro.family "darwin") -}}
|
|
||||||
/Applications/IntelliJ\ IDEA\ CE.app/Contents/MacOS/idea
|
|
||||||
{{- else if eq .host.distro.family "linux" -}}
|
|
||||||
/snap/intellij-idea-community/current/bin/idea.sh
|
|
||||||
{{- end -}}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{{- if (eq .host.qubes true) -}}
|
|
||||||
{{ .host.home }}/.local/share/ansible-qubes/bin/qrun
|
|
||||||
{{- end -}}
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.qubes true) -}}
|
|
||||||
{{ .host.home }}/.local/share/ansible-qubes/bin/qssh
|
|
||||||
{{- end -}}
|
|
|
@ -1,4 +0,0 @@
|
||||||
{{- if (eq .host.qubes true) -}}
|
|
||||||
{{ .host.home }}/.local/share/ansible-qubes/bin/qssh
|
|
||||||
{{- end -}}
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.distro.family "darwin") -}}
|
|
||||||
/usr/local/bin/greadlink
|
|
||||||
{{- end -}}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.distro.family "darwin") -}}
|
|
||||||
/bin/stty
|
|
||||||
{{- end -}}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{{- if (eq .host.distro.id "ubuntu") -}}
|
|
||||||
/usr/bin/yank-cli
|
|
||||||
{{- end -}}
|
|
Loading…
Reference in a new issue