Swap bspwmrc to fish; refactor root-level scripts

This commit is contained in:
mitchell 2021-12-28 15:03:49 -08:00
parent 43c56716f8
commit 8ac7a6cb37
6 changed files with 54 additions and 45 deletions

View File

@ -1,10 +1,9 @@
#!/bin/sh #!/usr/bin/env fish
if [ ! -e ~/.bspwm_no_lock ] if ! test -e ~/.bspwm_no_lock
then
slock & slock &
touch ~/.bspwm_no_lock touch ~/.bspwm_no_lock
fi end
setxkbmap -option altwin:swap_alt_win setxkbmap -option altwin:swap_alt_win
setxkbmap -option ctrl:swapcaps setxkbmap -option ctrl:swapcaps

View File

@ -4,14 +4,14 @@ function vm_inst -a name os_variant install_source
'c/cpus=' \ 'c/cpus=' \
'd/disk-size=' \ 'd/disk-size=' \
'b/bridge=' \ 'b/bridge=' \
'i/import' \ i/import \
'n/netboot' \ n/netboot \
-- $argv -- $argv
set -l memory '4096' set -l memory 4096
set -l vcpus '2' set -l vcpus 2
set -l disk_size '40' set -l disk_size 40
set -l bridge_iface 'br0' set -l bridge_iface br0
if test -n "$_flag_m" if test -n "$_flag_m"
set memory $_flag_m set memory $_flag_m
@ -33,8 +33,12 @@ function vm_inst -a name os_variant install_source
--name $name \ --name $name \
--memory $memory \ --memory $memory \
--vcpus $vcpus \ --vcpus $vcpus \
--os-variant $os_variant \ --os-variant $os_variant
--network bridge=$bridge_iface \
if test -n "$_flag_b"
set inst_args $inst_args \
--network bridge=$bridge_iface
end
if test -n "$_flag_i" if test -n "$_flag_i"
set inst_args $inst_args \ set inst_args $inst_args \

View File

@ -1,5 +1,7 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# Source: https://github.com/mitchell/run.fish # Source: https://github.com/mitchell/run.fish
#
# OUTDATED USE ./provision_linux
### Config ### ### Config ###
# Top-level configurations, like function prefixes and argument delimeters # Top-level configurations, like function prefixes and argument delimeters

View File

@ -1,4 +1,15 @@
#!/usr/bin/env fish #!/usr/bin/env fish
#
set general_help '
A collection of useful functions for provisioning arch/debian linux.
Either run a function like ./provision_linux <function> [arg [arg [...]]
or source the file and run them as commands:
$ source ./provision_linux
$ lint [args]
Run ./provision_linux <function_name> to see it\'s definition.
'
### Config ### ### Config ###
@ -14,8 +25,6 @@ for line in (cat /etc/os-release)
end end
### Commands ### ### Commands ###
# Add, edit, and remove commands freely below.
# To add a command simply create a function with this naming scheme: {run_func_prefix}_{name}.
function provision_default -d 'Provisioning terminal, desktop, and m-net' function provision_default -d 'Provisioning terminal, desktop, and m-net'
provision_terminal_env provision_terminal_env
@ -102,8 +111,10 @@ function provision_desktop_env -d 'Install base desktop utilities and configure
wget \ wget \
unzip \ unzip \
physlock \ physlock \
pulseaudio \ pipewire \
playerctl playerctl \
tar \
xz
set -l arch_pkgs \ set -l arch_pkgs \
@ -113,8 +124,9 @@ function provision_desktop_env -d 'Install base desktop utilities and configure
ttf-ibm-plex \ ttf-ibm-plex \
ttf-jetbrains-mono \ ttf-jetbrains-mono \
pavucontrol \ pavucontrol \
pulseaudio-alsa \
wmname \ wmname \
pipewire-pulse \
pipewire-alsa \
polybar \ polybar \
light \ light \
slock slock
@ -202,6 +214,7 @@ end
function provision_m_net -d 'Install syncthing and keepassxc' function provision_m_net -d 'Install syncthing and keepassxc'
log 'Installing m-net utilities' log 'Installing m-net utilities'
install_pkgs \ install_pkgs \
wireguard-tools \
keepassxc \ keepassxc \
syncthing syncthing
or return $status or return $status
@ -280,12 +293,25 @@ function install_pkgs -S
end end
function log -a message function log -a message
echo \n"---------------- $message ----------------"\n echo \n"--- $message ---"\n
end end
function main # --- execution/help handling ---
curl -fsS https://git.mjfs.us/mitchell/swim.fish/raw/branch/master/functions/sw.fish | source
run_swim_command $cmd_func_prefix $argv function help -a function_name -d 'Displays help for internal function'
if test -n "$function_name"
functions $function_name
else
echo $general_help
end
end end
main $argv argparse --ignore-unknown h/help -- $argv
if test -n "$_flag_h"
help $argv
else if test -n "$argv"
$argv
else
echo $general_help
end

22
swim
View File

@ -31,28 +31,6 @@ function format -d 'Format fish scripts'
fish_indent --write $src_fish_files fish_indent --write $src_fish_files
end end
function sync -d 'Run the sync script'
./sync $argv
end
function install_arch -d 'Run the install_arch script'
./install_arch $argv
end
function upgrade_debi -d 'Run the debian_upgrade script'
./upgrade_debian $argv
end
function provision -d 'Run the provision_linux script with the specified distro'
argparse 'd/distro=' -- $argv
if test -n "$_flag_d"
set -g distro $_flag_d
end
./provision_linux $argv[2..-1]
end
# --- execution/help handling --- # --- execution/help handling ---
function help -a function_name -d 'Displays help for internal function' function help -a function_name -d 'Displays help for internal function'

View File

@ -15,7 +15,7 @@ deb-src http://ftp.us.debian.org/debian unstable main contrib non-free' | sudo t
end end
function log -a message function log -a message
echo \n"---------------- $message ----------------"\n echo \n"--- $message ---"\n
end end
main main