mirror of
https://git.myvelabs.com/lab/archiso.git
synced 2025-12-17 21:26:15 +00:00
First commit
This commit is contained in:
commit
cf02f03a30
5 changed files with 444 additions and 0 deletions
142
zshrc
Normal file
142
zshrc
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
#
|
||||
# ~/.zshrc
|
||||
#
|
||||
# PS1='\e[31m[\u\e[0m@\h \W]\$ '
|
||||
|
||||
# iwd connection status
|
||||
function iwd-status
|
||||
{
|
||||
iwctl station $(iwctl station list | grep connected | awk '{print $(NF-1)}') show
|
||||
}
|
||||
|
||||
# Reflector mirrors
|
||||
function mirrors
|
||||
{
|
||||
[ ${1} ] || return 1
|
||||
echo
|
||||
reflector --country ${1} --age 24 --latest 20 --protocol https --fastest 25 --sort rate --save /etc/pacman.d/mirrorlist
|
||||
echo
|
||||
cat /etc/pacman.d/mirrorlist
|
||||
echo
|
||||
}
|
||||
|
||||
# Wireguard functions
|
||||
function wglist
|
||||
{
|
||||
if [ ${1} ]
|
||||
then
|
||||
ls /etc/wireguard | grep ${1}
|
||||
else
|
||||
ls /etc/wireguard
|
||||
fi
|
||||
}
|
||||
|
||||
function wd
|
||||
{
|
||||
for wireguard in $(wg show | grep interface | awk '{print $2}')
|
||||
do
|
||||
wg-quick down ${wireguard}
|
||||
done
|
||||
}
|
||||
|
||||
function wu
|
||||
{
|
||||
wd
|
||||
|
||||
if [ ${1} ]
|
||||
then
|
||||
wg-quick up $(ls /etc/wireguard | grep ${1} | shuf -n 1 | sed "s/.conf//g")
|
||||
else
|
||||
wg-quick up $(ls /etc/wireguard | shuf -n 1 | sed "s/.conf//g")
|
||||
fi
|
||||
}
|
||||
|
||||
# Shortcuts for optional auxilliaries
|
||||
function install-i3
|
||||
{
|
||||
mount -o remount,size=2G /run/archiso/cowspace
|
||||
pacman -Sy --ask 4 \
|
||||
xorg xorg-xinit i3-gaps i3status dmenu konsole kate dolphin breeze-icons pipewire-jack phonon-qt5-gstreamer \
|
||||
firefox firefox-decentraleyes firefox-ublock-origin ttf-dejavu
|
||||
echo 'exec i3' > ~/.xinitrc
|
||||
echo -e '\nXDG_CURRENT_DESKTOP=gnome' >/etc/environment
|
||||
startx
|
||||
}
|
||||
|
||||
function install-zfs
|
||||
{
|
||||
mount -o remount,size=2G /run/archiso/cowspace
|
||||
pacman-key --init
|
||||
cat >>/etc/pacman.conf <<'EOF'
|
||||
|
||||
[archzfs]
|
||||
Server = https://archzfs.com/$repo/$arch
|
||||
EOF
|
||||
pacman-key -r DDF7DB817396A49B2A2723F7403BD972F75D9D76
|
||||
pacman-key --lsign-key DDF7DB817396A49B2A2723F7403BD972F75D9D76
|
||||
|
||||
pacman -Sy --ask 4 archzfs-dkms linux-headers
|
||||
modprobe zfs
|
||||
}
|
||||
|
||||
# Bash completion
|
||||
autoload bashcompinit
|
||||
bashcompinit
|
||||
|
||||
function _installer
|
||||
{
|
||||
local cur prev
|
||||
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
case ${COMP_CWORD} in
|
||||
1)
|
||||
COMPREPLY=($(compgen -W "arch arch-vm vm arch-passthrough passthrough airgap server homelab recover" -- ${cur}))
|
||||
;;
|
||||
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _installer installer
|
||||
|
||||
function _iwd-connect
|
||||
{
|
||||
iwd_station=$(iwctl station list | grep connected | awk '{print $(NF-1)}')
|
||||
[ ${iwd_station} ] || return 1
|
||||
|
||||
local cur prev
|
||||
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
case ${COMP_CWORD} in
|
||||
1)
|
||||
COMPREPLY=($(compgen -W "$(iwctl station ${iwd_station} get-networks | awk '{print $1}' | grep -v -- 'Available\|---\|.*90m.*\S*')" -- ${cur}))
|
||||
;;
|
||||
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _iwd-connect iwd-connect
|
||||
|
||||
# Turn off sshd public-key-only authentication
|
||||
function ssh-off
|
||||
{
|
||||
rm /etc/ssh/sshd_config.d/zz-archiso.conf
|
||||
systemctl restart sshd.service
|
||||
}
|
||||
function ssh-on
|
||||
{
|
||||
echo 'PasswordAuthentication no
|
||||
AuthenticationMethods publickey' >/etc/ssh/sshd_config.d/zz-archiso.conf
|
||||
systemctl restart sshd.service
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue