68 Commits
main ... dev

Author SHA1 Message Date
407bdb2ddf Add single quotes around awk parameters. 2025-11-10 15:09:37 -07:00
d1cd9dddf1 Add quotes around location variable. 2025-11-10 15:08:26 -07:00
68eb84af52 Fix missing then. 2025-11-10 15:07:45 -07:00
46d1bfb70e Still thinking of rewording line 2. Modify spacing. 2025-11-10 15:05:42 -07:00
8970bb3a1b Add quotes in case path has spaces, which it shouldn't, but it's good practice to protect it anyways. 2025-11-10 14:58:21 -07:00
eae66f9967 Add back in direct volume assignment, may have been cut and not copied back in. Re-test to ensure all is working well. 2025-11-10 14:57:00 -07:00
2770bbac5f If the DWM helper functions are available, go ahead and source them for local usage. 2025-11-10 14:47:46 -07:00
a0f7773998 Add author and date. 2025-11-10 14:42:26 -07:00
6ccdb395cd Add calls to the dwm helper functions in the portion which sets the status bar time. Add a sleep so that a CPU is not always busy. 2025-11-10 14:42:10 -07:00
b48dbbeee1 Copy the new dwm function files into the global bin, usually /usr/local/bin/. 2025-11-10 14:41:38 -07:00
07cc51a5cc Make the storage functions more versatile. 2025-11-10 14:20:39 -07:00
428684b9b3 Change permissions for storage too. 2025-11-10 14:03:03 -07:00
e42e3b4fcd Change permissions. 2025-11-10 14:02:31 -07:00
856290c33f Add function to quickly check storage. 2025-11-10 14:02:16 -07:00
e7ae358fa9 Add function to check battery percentage. 2025-11-10 14:02:01 -07:00
16dfeca689 Add terminal based volume function! Tested to work great so far. 2025-11-10 13:44:23 -07:00
0e1cb8bacb Add slightly easier to remember shortcuts for DWM. 2025-11-09 20:59:02 -07:00
8898959a95 Fix typo in comment. 2025-11-09 20:01:14 -07:00
4c467fff6d Add multiple versions of calling hugo server. 2025-11-08 15:28:15 -07:00
c927a5bd2d Add alias for running hugo server with sane defaults. 2025-11-08 15:20:19 -07:00
32dfd0af25 Begin fixing package installs for DNF (Fedora). 2025-11-01 04:07:39 -07:00
8636a0e112 Add option to spit out facts. 2025-10-30 15:37:33 -07:00
4864ee3869 Convert dnf5 to dnf. 2025-10-30 15:37:17 -07:00
0d8d872bfc Fix typo in "portion". 2025-10-30 15:15:28 -07:00
b562308cf1 Remove header, ensure test data is after the blockinfile header by including the tags it's looking for. 2025-10-30 15:15:13 -07:00
c2790e2de4 Fix error "File contains no section headers." when creating test config. 2025-10-30 15:02:16 -07:00
2be7e028b6 Add Mullvad to the end of favorites list. 2025-10-30 12:13:55 -07:00
0920493634 Create the config directory so that tee can create the files. 2025-10-25 15:46:52 -07:00
03b8169401 Try adding the output to the files in a different way. 2025-10-25 15:38:12 -07:00
cfc2694737 Add that the file contains test data. Add output of the function for testing. 2025-10-25 15:30:40 -07:00
fca20b31bd Change wording so that user does not expect files to exist right away. 2025-10-25 15:20:59 -07:00
1f4abd2d6c Create the filepaths for the config files. Output the files and their contents after creation. 2025-10-25 15:18:55 -07:00
a42d1d05df Fix the parameter switches. 2025-10-25 15:16:50 -07:00
07d1adc926 Create the proper contents in each test file. 2025-10-25 15:15:30 -07:00
71ca410123 Add ability to spawn basic configurations for testing. 2025-10-25 15:12:03 -07:00
c46c78519b Do not mention using the default branch if using local. 2025-10-25 14:58:03 -07:00
816a0d4f69 Do not check the kernelfor the OS when inside of Docker containers. 2025-10-25 14:43:14 -07:00
f8a60b4287 Change final backup check to use du again, not ls -l. 2025-10-24 15:26:40 -07:00
a7f395a62a Remove test output. 2025-10-24 15:18:44 -07:00
f02aec2cdb Fix case of DOCKER value. 2025-10-24 15:16:57 -07:00
a94959bcf9 Add more verbosity. Change "BACKUP" to "DOCKER". 2025-10-24 15:15:05 -07:00
5004250f85 Add aliases for reloading shell like in Termux environment. 2025-10-24 14:55:11 -07:00
4c4d4bbef7 Additional enhancements to pulling Production backups. 2025-10-24 14:53:36 -07:00
d32b636a99 Add more output. 2025-10-23 20:02:52 -07:00
a7083733cc Add check on whether any zips were successful. 2025-10-23 19:59:56 -07:00
97ddcc4573 Properly handle removing the failed files. 2025-10-23 19:50:57 -07:00
dc2ae57bd6 Add command to pull production backups while making sure that failed downloads are easily identified. 2025-10-23 19:42:50 -07:00
82ab31b9ea Add Grayjay to GNOME favorites. 2025-10-20 19:33:09 -07:00
49ababedc5 Add the flatpak Grayjay. 2025-10-20 19:32:49 -07:00
0d3931d738 Fix cronjobs to use BASH for RANDOM variable. 2025-10-19 21:41:59 -07:00
7c93f25a5d Add output for why dev branch shows up twice during load-prod. 2025-10-15 06:45:49 -07:00
8445b64d6b Check if the dev branch exists before moving to it. 2025-10-15 06:42:16 -07:00
8dfb3fe2a6 Change rollback aliases to only go down 1 layer. Add reset aliases for going all the way back to main. 2025-10-15 06:38:50 -07:00
5b749d2100 Fix failed branch switch. Hardcode to dev! 2025-10-15 06:35:02 -07:00
57ca267aa5 Add back the display of the current local branch we're on. Add newlines for readability. 2025-10-15 06:32:28 -07:00
2ca308c287 Re-do changes lost between branch pointing. 2025-10-15 06:28:38 -07:00
40ee72b587 Only continue each commnd if they are successful. 2025-10-15 06:15:13 -07:00
13bc98d7ef Further enhancments to load-branch. Better output and branch choices. 2025-10-15 06:06:05 -07:00
d916637798 Complete the conditional branches. 2025-10-15 05:53:48 -07:00
71d236d0ba Add aliases to roll branches back to main, AKA the last official pull request. 2025-10-15 05:48:18 -07:00
d81c424878 Allow using load-prod and load-stage with any branch, and default to dev if nothing is provided. 2025-10-15 05:47:01 -07:00
73e527640f Add heads back onto the ls-remote command. 2025-10-15 05:41:12 -07:00
aa3075a9fc Do not do switch back to sender if did not switch to receiver. 2025-10-15 05:33:17 -07:00
89cdf8157f Add other missing then. 2025-10-15 05:19:57 -07:00
4e0ff86295 Add missing then. 2025-10-15 05:19:21 -07:00
305b8df6ff Ensure user is on dev branch if it exists. 2025-10-15 05:09:56 -07:00
6a78933875 Add helper for reorienting a git branch. 2025-10-15 04:52:15 -07:00
7095636915 Remove trailing s. 2025-10-14 15:03:43 -07:00
14 changed files with 507 additions and 28 deletions

View File

@@ -2,7 +2,7 @@
# Define program names for package builtin.
# This file is for ALL systems and should not include UI components.
- name: General | Facts | Packages | Shared Defaults
- name: General | Facts | Package | Shared Defaults
set_fact:
sshfs: sshfs
tar: tar
@@ -12,7 +12,7 @@
dig: dig
neofetch: neofetch
- name: General | Facts | Packages | Parrot OS Fixes
- name: General | Facts | Package | Parrot OS Fixes
set_fact:
ansible_pkg_mgr: "apt"
ansible_python_interpreter: "/usr/bin/python3"
@@ -56,10 +56,15 @@
encfs: fusefs-encfs
when: ansible_system == "FreeBSD"
- name: General | Facts | Package | dnf (Fixes) # TBD: Fix + test package names: mlocate, dig, neofetch
set_fact:
ansible_pkg_mgr: dnf
when: ansible_pkg_mgr in ("dnf5")
- name: General | Facts | Package | dnf
set_fact:
sshfs: fuse-sshfs
locate: mlocate
locate: plocate
opensshd: openssh
microcode_amd: microcode_ctl
microcode_intel: microcode_ctl

8
files/dwm/battery.function Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# 2025-11-10 Hyperling
function battery {
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | grep -o "[0-9.%]*"
}
alias show-battery="battery"
alias battery-display="battery"

View File

@@ -104,7 +104,11 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_q, quit, {0} },
// Mine
{ MODKEY, XK_q, killclient, {0} },
// Volume (https://varunbpatil.github.io/2013/09/28/dwm.html)
// extra search shortcut
{ MODKEY, XK_s, spawn, {.v = dmenucmd } },
// fullscreen shortcut for m onocle
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
// Volume (https://varunbpatil.github.io/2013/09/28/dwm.html)
{ 0, 0x1008ff12,spawn, {.v = mutecmd } },
{ 0, 0x1008ff11,spawn, {.v = lowervolcmd } },
{ 0, 0x1008ff13,spawn, {.v = raisevolcmd } },

View File

@@ -5,17 +5,17 @@
## Load System Libs ##
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
if [ -d /usr/local/etc/X11/xinit/xinitrc.d ]; then
for f in /usr/local/etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
for f in /usr/local/etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
@@ -35,8 +35,23 @@ xsetroot -solid "$purple"
#exec slstatus &
# Custom #
source "`which volume.function`"
source "`which battery.function`"
source "`which storage.function`"
if [[ "`storage-root`" == "`storage-home`" ]]; then
storage_cmd=echo 'Storage: `storage-root-dwm`)"'
else
storage_cmd=echo '"Storage(Root:`storage-root-dwm` Home:`storage-home-dwm`)'
fi
while true; do
xsetroot -name "`whoami`@`hostname` `date +"%Y-%m-%d %H:%M:%S"`"
readout="$readout Battery: `battery-display`"
readout="$readout | `storage_cmd`"
readout="$readout | `volume-display`"
readout="$readout | `whoami`@`hostname`"
readout="$readout `date +"%Y-%m-%d %H:%M:%S"`"
xsetroot -name "$readout"
readout=""
sleep 0.75
done &

35
files/dwm/storage.function Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# 2025-11-10 Hyperling
function storage {
location="$1"
style="$2"
if [[ -z "$location" ]]; then
echo "ERROR: Location must be passed. $location"
fi
if [[ "$style" == "%" || "$style" == "pct" || "$style" == "percent" ]]; then
df -h "$location" | tail -n 1 | awk '{print $5}'
elif [[ "$style" == "/" || "$style" == "use" || "$style" == "usage" ]]; then
df -h "$location" | tail -n 1 | awk '{print $3"/"$2}'
else
df -h "$location" | tail -n 1 | awk '{print $5" Free, "$3"/"$2" Used"}'
fi
}
export dwm_storage_style="usage"
function storage-root {
storage / "$1"
}
function storage-root-dwm {
storage-root "$dwm_storage_style"
}
function storage-home {
storage /home "$1"
}
function storage-home-dwm {
storage-root "$dwm_storage_style"
}

153
files/dwm/volume.function Executable file
View File

@@ -0,0 +1,153 @@
#!/usr/bin/env bash
# 2025-11-10 Hyperling
# Volume management for systems without working volume buttons.
# Written for ease of use in terminal and simple window management systems.
function volume-usage {
cat <<- EOF
Usage: volume [%int] [(+/-)%int] [-d] [-r] [-t] [-h]
Set to a static value:
volume 100, volume 65
Increment or decrement. Passing only + or - and no number defaults to 5.
volume -5, volume 5-, volume - 5, volume 5 -
volume +20, volume 20+, volume + 20, volume 20 +
Display the current volume:
volume,
volume-display, volume display, volume --display, volume -d,
volume +d
Set volume to a random number between 0 and 100.
volume-random, volume random, volume --random, volume -r
Be silly and oscillate volume in a loop:
volume-trip, volume trip, volume --trip, volume -t
Display this help text:
volume-usage,
volume-help volume help, volume --help, volume -h
EOF
return "$1"
}
alias volume-help="volume-usage"
alias vol-h="volume-help"
function volume {
if [[ "$1" == "--help" || "$1" == "help" || "$1" == "-h" ]]; then
volume-usage
fi
if [[ (-z "$1" && -z "$2")
|| "$1" == "--display" || "$1" == "display" || "$1" == "-d" || "$1" == "+d"
]]; then
volume-display
fi
if [[ "$1" == *"%"* || "$2" == *"%"* ]]; then
set -- "${1//%/}" "${2//%/}"
fi
dir=""
amt=""
# Check if format is written text.
if [[ "$1" == "full" || "$1" == "max" ]]; then
amt=100
fi
if [[ "$1" == "mute" || "$1" == "none" ]]; then
amt=0
fi
# Check if the format is "volume +/- %int"
if [[ -z "$amt" && -z "$dir" ]]; then
if [[ "$1" == "+" || "$1" == "-" ]]; then
dir="$1"
amt="$2"
if [[ -z "$2" ]]; then
amt="5"
else
amt="$2"
fi
fi
fi
# Check if the format is "volume +/- %int".
if [[ -z "$amt" && -z "$dir" ]]; then
if [[ "$2" == "+" || "$2" == "-" ]]; then
amt="$1"
dir="$2"
fi
fi
# Check if amount and direction are adjacent, and if so, pull the values.
if [[ -z "$amt" && -z "$dir" ]]; then
if [[ "$1" == *"+"* ]]; then
dir="+"
elif [[ "$1" == *"-"* ]]; then
dir="-"
fi
if [[ -n "$dir" && -z "$amt" ]]; then
amt="$1"
amt=${amt//-/}
amt=${amt//+/}
fi
fi
# Check if format is direct volume.
if [[ -z "$dir" && -z "$amt" && -n "$1" && -z "$2" ]]; then
amt="$1"
fi
if [[ -n "$dir" && -n "$amt" ]]; then
echo "> Changing volume by '$dir$amt%'."
amixer -q sset Master ${amt}%${dir}
echo "> Volume is now '`volume-display`'."
return 0
fi
if [[ -z "$dir" && -n "$1" ]]; then
echo "> Setting volume to '$amt'."
amixer -q sset Master ${amt}%
echo "> Volume has been set to '`volume-display`'."
return 0
fi
echo "Error: Should not have made it here. Please report this to the developer."
echo "$0 $1 $2"
return 7
}
alias vol="volume "
alias vol-="volume - "
alias vol+="volume + "
function volume-display {
if [[ "$1" == "-v" || "$1" == "--verbose" || "$1" == "verbose" ]]; then
amixer sget Master
else
amixer sget Master | egrep -o '[0-9]{1,3}%' | head -n 1
fi
}
alias "vol-d"="volume-display"
# Go up and down until cancelled.
#function volume-trip {
# curr eq amixer current readout
# if curr lt 50 then dir eq + else dir eq -
# while true; do
# if vol is 0 then dir eq +
# if vol is 100 then dir eq -
# curr eq \$curr $dir 1
# amixer set volume to curr
# sleep 0.1
# done
#}
#alias vol-t="volume-trip"
#alias volume-wub="volume-trip"
#alias vol-w="volume-wub"
#function volume-random {
# v eq $RANDOM % 101
# amixer set volume eq v
#}
#alias vol-r="volume-random"

View File

@@ -48,7 +48,7 @@ fi
if [[ -e "$BACKUP" ]]; then
ls -alh "$BACKUP"
echo "*** '$BACKUP' created successfully! ***"s
echo "*** '$BACKUP' created successfully! ***"
else
echo "*** '$BACKUP' not found! ***"
exit 1

103
setup.sh
View File

@@ -9,13 +9,18 @@ LOCAL=$DIR/local.yml
URL="https://git.hyperling.com/me/env-ansible"
BRANCH="main"
config_dir="/usr/local/etc/hyperling-scm"
general_config="$config_dir/general.ini"
workstation_config="$config_dir/workstation.ini"
server_config="$config_dir/server.ini"
## Functions ##
# Accepts 1 parameter, it is used as the exit status.
function usage {
cat <<- EOF
$PROG [-l] [-b branch_name] [-h]
$PROG [-l] [-b branch_name] [-g] [-w] [-s] [-f] [-h]
Program to initialize synchronization with Hyperling's Ansible configuration.
$URL
@@ -23,8 +28,12 @@ function usage {
-l : Run the local playbook associated with this $PROG.
This is helpful for development or just saving bandwidth.
It also provides prettier colors than the plaintext from ansible-pull. ;)
-b branch_name: Download and run a specific branch. Default is $BRANCH.
-h : Display this help text
-b branch_name : Download and run a specific branch. Default is $BRANCH.
-g : Enable the General config with test contents.
-w : Enable the Workstation config with test contents.
-s : Enable the Server config with test contents.
-f : Display this system's facts.
-h : Display this help text.
EOF
exit $1
@@ -32,10 +41,14 @@ function usage {
## Parameter Parsing ##
while getopts ":lb:h" arg; do
while getopts ":lb:gwsfh" arg; do
case $arg in
l) local="Y" && echo "Running $LOCAL as the playbook." ;;
b) branch="$OPTARG" && echo "Using branch $branch instead of $BRANCH." ;;
g) create_general="Y" && echo "Requested '$general_config'." ;;
w) create_workstation="Y" && echo "Requested '$workstation_config'." ;;
s) create_server="Y" && echo "Requested '$server_config'." ;;
f) show_facts="Y" ;;
h) usage ;;
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
esac
@@ -47,15 +60,32 @@ if [[ ! -z $1 && $1 != "-"* ]]; then
usage 1
fi
if [[ $branch == "" ]]; then
if [[ -z "$local" && "$branch" == "" ]]; then
echo "Using default branch $BRANCH."
branch="$BRANCH"
fi
if [[ -n "$create_general" && -f "$general_config" ]]; then
echo "WARNING: General configuration already exists, will not overwrite."
ls -lh "$general"
fi
if [[ -n "$create_workstation" && -f "$workstation_config" ]]; then
echo "WARNING: Workstation configuration already exists, will not overwrite."
ls -lh "$workstation_config"
fi
if [[ -n "$create_server" && -f "$server_config" ]]; then
echo "WARNING: Server configuration already exists, will not overwrite."
ls -lh "$server_config"
fi
## Main ##
os="$(cat /etc/os-release)"
os="$os $(uname -a)"
if [[ ! -f /.dockerenv ]]; then
# If we are not in a Docker container, also check what the kernel says.
os="$os $(uname -a)"
# Docker containers use the host kernel which gives an incorrect reading.
fi
echo "Making sure all necessary packages are installed..."
if [[ `which ansible > /dev/null; echo $?` != 0 ]]; then
@@ -97,10 +127,71 @@ if [[ `which ansible > /dev/null; echo $?` != 0 ]]; then
fi
echo "Installed!"
if [[ "$show_facts" == "Y" ]]; then
echo "Showing Ansible Facts"
ansible localhost -m setup --connection=local
fi
#echo "Adding Ansible Collections..."
#ansible-galaxy collection install community.general
#echo "Added!"
# Create basic layouts if configs do not exist and are requested.
if [[ -n "$create_general"
|| -n "$create_workstation"
|| -n "$create_server" ]]
then
sudo mkdir -pv "$config_dir"
MARK1="BEGIN"
MARK2="END"
fi
if [[ -n "$create_general" && ! -f "$general_config" ]]; then
function print_general_contents {
cat <<- EOF
; $MARK1 MANAGED BY ANSIBLE | Generic Config
; $MARK2 MANAGED BY ANSIBLE | Generic Config
; TEST DATA
enable=true
user=test
user_desc=Test
branch=$branch
; TEST DATA
EOF
}
print_general_contents | sudo tee "$general_config"
ls -lh "$general_config"
fi
if [[ -n "$create_workstation" && ! -f "$workstation_config" ]]; then
function print_workstation_contents {
cat <<- EOF
; $MARK1 MANAGED BY ANSIBLE | Workstation Config
; $MARK2 MANAGED BY ANSIBLE | Workstation Config
; TEST DATA
enable=true
coding=true
editing=false
gaming=false
; TEST DATA
EOF
}
print_workstation_contents | sudo tee "$workstation_config"
ls -lh "$workstation_config"
fi
if [[ -n "$create_server" && ! -f "$server_config" ]]; then
function print_server_contents {
cat <<- EOF
; $MARK1 MANAGED BY ANSIBLE | Server Config
; $MARK2 MANAGED BY ANSIBLE | Server Config
; TEST DATA
enable=true
; TEST DATA
EOF
}
print_server_contents | sudo tee "$server_config"
ls -lh "$server_config"
fi
echo "Provisioning Ansible..."
if [[ $local == "Y" ]]; then
sudo ansible-playbook $LOCAL

View File

@@ -26,7 +26,7 @@
blockinfile:
path: "{{ gen_file }}"
block: |
; Please note that all potions require lowercase keys and values.
; Please note that all portions require lowercase keys and values.
;
;;;;;;;;;;;;;;;;;;;; Basic Options ;;;;;;;;;;;;;;;;;;;;
;

View File

@@ -564,6 +564,16 @@
echo -e "\n*** `basename $project` ***"
cd $project
if [[ -d .git ]]; then
git ls-remote --exit-code --heads origin dev
dev_exists="$?"
if [[ "$dev_exists" == 0 ]]; then
git switch dev
elif [[ "$dev_exists" == 2 ]]; then
git switch main
else
echo "ERROR: Unknown status for dev_exists, '$dev_exists'."
continue
fi
git pull
git push
else
@@ -783,16 +793,70 @@
date "+%Y%m%d"
}
function_backup: |
export BACKUP_DIR="/srv/backup"
function backup {
/usr/local/bin/backup_system.sh
}
alias backup-system="backup"
alias system-backup="backup"
alias check-backups="ll /srv/backup"
alias check-backups="ll $BACKUP_DIR"
function clean-backup {
sh -c "rm -rfv /srv/backup/*"
sh -c "rm -rfv $BACKUP_DIR/*"
}
alias clean-backups="clean-backup"
function_pull_prod_backups: |
export DOCKER="Docker"
export SYSTEM="System"
function pull_prod_backup {
if [[ -z "$1" || ("$1" != "$DOCKER" && "$1" != "$SYSTEM") ]]; then
echo "ERROR: Parameter 1 not correct, expecting '$DOCKER' or '$SYSTEM'."
return 1
fi
backup_type="$1"
echo "Looking for '*${backup_type}*.zip'"
ls -lh *${backup_type}*.zip 2>/dev/null
status="$?"
if [[ "$status" == "0" ]]; then
echo "File already downloaded, skipping."
return 0
else
echo "File still needed, downloading to local tmp/."
fi
mkdir -pv tmp
scp -P {{ prod_port }} \
{{ prod_user }}@{{ prod_host }}:"$BACKUP_DIR/*${backup_type}*.zip" \
tmp/
if [[ "$?" == "0" ]]; then
echo "Succeeded!"
mv -v tmp/*.zip ./
rmdir -v tmp
else
echo "Failed!"
mv tmp ~/TRASH/"tmp_`now`"
fi
}
function pull_prod_backups {
dir="ProductionBackups-Pulled`today`"
mkdir -pv "$dir"
cd "$dir"
pull_prod_backup "$DOCKER"
pull_prod_backup "$SYSTEM"
du -h *.zip | sort -h
status="$?"
cd ..
if [[ "$status" != 0 ]]; then
echo "Failed to find zip files, removing folder."
rmdir -v "$dir"
return 1
fi
echo "Done!"
}
alias pull-prod-backups="pull_prod_backups"
alias pull-backups="pull_prod_backups"
alias prod-backups="pull_prod_backups"
alias prod-backup="pull_prod_backups"
alias pull-prod="pull_prod_backups"
alias prod-pull="pull_prod_backups"
function_log: |
function log {
echo -e "$1"
@@ -881,6 +945,89 @@
alias_sudo: |
# Allows for alias expansions when using sudo, such as doing "sudo ll".
alias sudo="sudo "
function_load_branch: |
# Change a branch to point at another.
function load-branch {
rcvr="$1" # branch which we want to modify
base="$2" # branch with the changes we want
if [[ "$rcvr" == "main" ]]; then
echo "*** ERROR: Are you nuts, fool!? Not main! Do it manually! ***"
exit 1
fi
if [[ -z "$base" ]]; then
if [[ "$rcvr" == "prod" ]]; then
base="stage"
elif [[ "$rcvr" == "stage" ]]; then
base="dev"
else
echo "* Unsure which branch to use for '$rcvr'. Please specify."
exit 1
fi
echo "* Base was not specified, using '$base' for '$rcvr'."
else
echo "* Requested pointing '$rcvr' branch to '$base'."
fi
echo -e "\n* Ensuring we are on base branch '$base'." &&
git switch "$base" &&
echo -e "\n* Changing pointer for '$rcvr' to '$base'." &&
git branch -f "$rcvr" "$base" &&
#echo -e "\n* Switching to branch '$rcvr'." &&
#git switch "$rcvr" &&
echo -e "\n* Forcing push on branch '$rcvr'." &&
git push --force --set-upstream origin "$rcvr" &&
echo -e "\n* Done! Displaying list of remote branches." &&
git ls-remote --heads | sort
if [[ "$base" != "dev" ]]; then
echo -e "\n* Checking if a dev branch exists."
git ls-remote --exit-code --heads origin dev
dev_exists="$?"
if [[ "$dev_exists" == 0 ]]; then
echo -e "\n* Switching back to dev."
git switch dev
elif [[ "$dev_exists" == 2 ]]; then
echo -e "\n* Switching back to main."
git switch main
else
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
fi
fi
echo -e "\n* Verifying which branch we're on."
git branch
}
alias load-prod="load-branch prod"
alias load-stage="load-branch stage"
alias rollback-prod="load-branch prod main"
alias rollback-stage="load-branch stage prod"
alias rollback-dev="load-branch dev stage"
alias reset-prod="load-branch prod main"
alias reset-stage="load-branch stage main"
alias reset-dev="load-branch dev main"
alias_reload_bash: |
alias reload-bash="source ~/.bashrc"
alias bash-reload="reload-bash"
alias shell-reload="reload-bash"
alias reload-shell="reload-bash"
alias reload="reload-bash"
alias_hugo_server: |
alias hugo-server-dev="hugo server -D --gc --ignoreCache --noHTTPCache --disableFastRender"
alias hugo-server-stage="hugo server --gc --noHTTPCache --disableFastRender"
alias hugo-server-prod="hugo server --gc --minify"
alias hugo-server="hugo-server-dev"
dwm_functions: |
if [[ -f "{{ global_bin }}/volume.function" ]]; then
source "{{ global_bin }}/volume.function"
fi
if [[ -f "{{ global_bin }}/battery.function" ]]; then
source "{{ global_bin }}/battery.function"
fi
if [[ -f "{{ global_bin }}/storage.function" ]]; then
source "{{ global_bin }}/storage.function"
fi
- name: General | Account Management | Users | Files | Common Variable
set_fact:
@@ -952,10 +1099,15 @@
{{ alias_ansible_facts }}
{{ function_now }}
{{ function_backup }}
{{ function_pull_prod_backups }}
{{ function_log }}
{{ function_debian_upgrade }}
{{ function_ebook_convert }}
{{ alias_sudo }}
{{ function_load_branch }}
{{ alias_reload_bash }}
{{ alias_hugo_server }}
{{ dwm_functions }}
- name: General | Account Management | Users | Files | .bashrc
blockinfile:

View File

@@ -12,7 +12,7 @@
user: ansible
name: "Ansible Sync"
minute: "*/30"
job: "sleep $(( $RANDOM / 20 )); sudo {{ ansible_pull_exec.stdout }} -v -o -U {{ git_repo_http }} --checkout {{ branch }}"
job: "bash -c 'sleep $(( $RANDOM / 20 )); sudo {{ ansible_pull_exec.stdout }} -v -o -U {{ git_repo_http }} --checkout {{ branch }}'"
state: present
disabled: "{{ 'yes' if no_telem else 'no' }}"
@@ -21,6 +21,6 @@
user: ansible
name: "Ansible Weekly Forced Sync"
special_time: daily
job: "sleep $(( $RANDOM / 1 )); sudo {{ ansible_pull_exec.stdout }} -v -U {{ git_repo_http }} --checkout {{ branch }}"
job: "bash -c 'sleep $(( $RANDOM / 1 )); sudo {{ ansible_pull_exec.stdout }} -v -U {{ git_repo_http }} --checkout {{ branch }}'"
state: present
disabled: "{{ 'yes' if no_telem else 'no' }}"

View File

@@ -43,6 +43,7 @@
- { app: "org.gimp.GIMP", name: "gimp", extra: "" }
- { app: "org.libreoffice.LibreOffice", name: "office", extra: "" }
- { app: "com.transmissionbt.Transmission", name: "transmission", extra: "" }
- { app: "app.grayjay.Grayjay", name: "grayjay", extra: "" }
flatpaks_coding:
- { app: "com.vscodium.codium", name: "codium-flatpak", extra: "" }
- { app: "com.google.AndroidStudio", name: "android-studio", extra: "" }

View File

@@ -19,9 +19,11 @@
, 'codium.desktop'
, 'org.shotcut.Shotcut.desktop'
, 'io.lmms.LMMS.desktop'
, 'app.grayjay.Grayjay.desktop'
, 'io.lbry.lbry-app.desktop', 'lbry.desktop'
, 'com.valvesoftware.Steam.desktop'
, 'net.lutris.Lutris.desktop'
, 'mullvad-vpn.desktop'
]"
dconf_terminal: gnome-terminal
dconf_theme: Adwaita-dark

View File

@@ -3,7 +3,7 @@
# https://dwm.suckless.org/
# https://sites.google.com/site/lazyboxx/-articles/dwm-a-newbie-s-guide#TOC-Status-Bar
#TODO: Move this to tasks/shared/ pasth rather than tasks/linux/.
#TODO: Move this to tasks/shared/ path rather than tasks/linux/.
#TODO: Generate files based on blockinfile.
#TODO: Fix config.mk for FreeBSD automatically (use /usr/local/ for libs not /usr/X11RC/)
#TODO: scm.sh to use bash variable so that FreeBSD correctly hits /usr/local/bin/bash.
@@ -23,14 +23,14 @@
## Download ##
- name: Workstation | Linux | Software | DWM | Git Clone
git:
git:
repo: https://git.suckless.org/dwm
dest: "{{ dwm_install_dir }}"
clone: yes
force: yes
- name: Workstation | Linux | Software | DWM | Git Clone (st)
git:
git:
repo: https://git.suckless.org/st
dest: "{{ st_install_dir }}"
clone: yes
@@ -78,3 +78,16 @@
owner: root
group: "{{ root_group }}"
mode: 0644
## Helper Functions for Status Bar ##
- name: Workstation | Linux | Software | DWM | Status Bar Functions
copy:
src: "{{ item }}"
dest: "{{ global_bin }}"
owner: root
group: "{{ root_group }}"
mode: 0644
with_fileglob:
- "dwm/*.function"