Compare commits

...

6 Commits

8 changed files with 214 additions and 165 deletions

84
001_swap-caps.sh Executable file → Normal file
View File

@ -1,79 +1,37 @@
#!/usr/bin/env zsh
#!/bin/bash
# https://thesynack.com/posts/persistent-capslock-behavior/
# Default destination directory if not provided
DEST=${1:-/etc/skel}
# xmodmap
#cat > ~/.Xmodmap << 'EOF'
#! Swap caps lock and escape
#remove Lock = Caps_Lock
#keysym Escape = Caps_Lock
#keysym Caps_Lock = Escape
#add Lock = Caps_Lock
#EOF
#
#xmodmap ~/.Xmodmap
#cat <<EOF | sudo tee ${HOME}/.config/autostart/xmodmap.desktop >/dev/null
#[Desktop Entry]
#Name=Xmodmap
#Exec=/usr/bin/xmodmap ${HOME}/.Xmodmap
#Terminal=false
#Type=Application
#X-GNOME-Autostart-enabled=true
#EOF
#
#chmod +x ~/.config/autostart/xmodmap.desktop
# Console tty
#cat <<EOF | sudo loadkeys
#keycode 1 = Caps_Lock
#keycode 58 = Escape
#EOF
#setxkbmap -model pc104 -layout gb,us -variant ,dvorak -option caps:swapecape
# Create the.xinitrc.d directory if it doesn't exist
mkdir -p ${DEST}/.xinitrc.d
# Write the setxkbmap configuration to a script file
cat <<EOF | sudo tee ${DEST}/.xinitrc.d/setxkbmap.sh >/dev/null
#!/usr/bin/env bash
#!/bin/bash
setxkbmap -model pc104 -layout gb,us -option caps:swapecape
EOF
# Make the script executable
chmod +x ${DEST}/.xinitrc.d/setxkbmap.sh
# default keyboard layout is described in /etc/default/keyboard and it is shared between X and the console.
# FIXME:man keyboard says to use VARIABLE=VALUE not the space separated below.
# Keyboard configuration adjustments
config_file="/etc/default/keyboard"
typeset -A rules
rules=(
"XKBMODEL" "pc105"
"XKBLAYOUT" "extd"
"XKBVARIANT" ""
"XKBOPTIONS" "caps:swapescape"
"BACKSPACE" "guess"
)
typeset -A rules
rules=(
"XKBMODEL" "pc105"
"XKBLAYOUT" "extd"
"XKBVARIANT" ""
"XKBOPTIONS" "caps:swapescape"
"BACKSPACE" "guess"
)
for rule in "${(@k)rules}"; do
regex="s/^#\?\(${rule}\s*\).*$/\1 ${rules[${rule}]}/"
# regex="s/^#\?\(${rule}\s*\).*$/\1=${rules[${rule}]}/"
sudo sed -i "${regex}" ${config_file};
done
for rule in "${rules[@]}"; do
regex="s/^#\?\(${rule}\s*\).*$/\1=${rules[$rule]}/"
sudo sed -i "${regex}" ${config_file}
done
# Trigger udevadm to apply changes
sudo udevadm trigger --subsystem-match=input --action=change
#cat <<EOF | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf > /dev/null
#Section "InputClass"
# Identifier "system-keyboard"
# MatchIsKeyboard "on"
# Option "XkbLayout" "gb,us"
# Option "XkbModel" "pc104"
# Option "XkbVariant" ""
# Option "XkbOptions" "caps:swapescape"
#EndSection
#EOF
#echo "enlightenment desktop settings-input-keyboard allowd swapping esc with caps."

79
001_swap-caps.zsh Executable file
View File

@ -0,0 +1,79 @@
#!/usr/bin/env zsh
# https://thesynack.com/posts/persistent-capslock-behavior/
DEST=${1:-/etc/skel}
# xmodmap
#cat > ~/.Xmodmap << 'EOF'
#! Swap caps lock and escape
#remove Lock = Caps_Lock
#keysym Escape = Caps_Lock
#keysym Caps_Lock = Escape
#add Lock = Caps_Lock
#EOF
#
#xmodmap ~/.Xmodmap
#cat <<EOF | sudo tee ${HOME}/.config/autostart/xmodmap.desktop >/dev/null
#[Desktop Entry]
#Name=Xmodmap
#Exec=/usr/bin/xmodmap ${HOME}/.Xmodmap
#Terminal=false
#Type=Application
#X-GNOME-Autostart-enabled=true
#EOF
#
#chmod +x ~/.config/autostart/xmodmap.desktop
# Console tty
#cat <<EOF | sudo loadkeys
#keycode 1 = Caps_Lock
#keycode 58 = Escape
#EOF
#setxkbmap -model pc104 -layout gb,us -variant ,dvorak -option caps:swapecape
mkdir -p ${DEST}/.xinitrc.d
cat <<EOF | sudo tee ${DEST}/.xinitrc.d/setxkbmap.sh >/dev/null
#!/usr/bin/env bash
setxkbmap -model pc104 -layout gb,us -option caps:swapecape
EOF
chmod +x ${DEST}/.xinitrc.d/setxkbmap.sh
# default keyboard layout is described in /etc/default/keyboard and it is shared between X and the console.
# FIXME:man keyboard says to use VARIABLE=VALUE not the space separated below.
config_file="/etc/default/keyboard"
typeset -A rules
rules=(
"XKBMODEL" "pc105"
"XKBLAYOUT" "extd"
"XKBVARIANT" ""
"XKBOPTIONS" "caps:swapescape"
"BACKSPACE" "guess"
)
for rule in "${(@k)rules}"; do
regex="s/^#\?\(${rule}\s*\).*$/\1 ${rules[${rule}]}/"
# regex="s/^#\?\(${rule}\s*\).*$/\1=${rules[${rule}]}/"
sudo sed -i "${regex}" ${config_file};
done
sudo udevadm trigger --subsystem-match=input --action=change
#cat <<EOF | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf > /dev/null
#Section "InputClass"
# Identifier "system-keyboard"
# MatchIsKeyboard "on"
# Option "XkbLayout" "gb,us"
# Option "XkbModel" "pc104"
# Option "XkbVariant" ""
# Option "XkbOptions" "caps:swapescape"
#EndSection
#EOF
#echo "enlightenment desktop settings-input-keyboard allowd swapping esc with caps."

View File

@ -1,33 +1,32 @@
#!/usr/bin/env bash
# Adding a new key requires:
# * the key name must be added to ssh_keys list
# * the key and the corresponding URL must be added to the ssh_configs array
HOME=${1:-/etc/skel}
LOCAL_USER_EMAIL=cyteen@ring-zero.co.uk
KEY_SCRIPTS_DIR="/tmp/gen_ssh_keys"
mkdir -p "${KEY_SCRIPTS_DIR}"
# Define an array of SSH key names
# Define an list of SSH key names
ssh_keys=("id_rsa" "devuan_rsa" "debian_rsa" "github_rsa" "gitlab_rsa" "gitea_rsa")
# conf_print_resolvconf() {
# cat <<-EOF
# EOF
# }
# conf_print_hostname | sudo tee $strapdir/etc/resolvconf >/dev/null
# Configure ohmyzsh to look for specific keys dynamically
cat <<-FOE | tee "${KEY_SCRIPTS_DIR}"/set-zstyle.sh >/dev/null
cat <<-FOE | tee ${KEY_SCRIPTS_DIR}/set-zstyle.sh >/dev/null
#!/bin/bash
cat <<-EOF | tee -a "${HOME}"/.zshrc.pre-plugins.d/001_ssh-agent >/dev/null
mkdir -p ${HOME}/.zshrc.pre-plugins.d/001_ssh-agent
cat <<-EOF | tee -a ${HOME}/.zshrc.pre-plugins.d/001_ssh-agent >/dev/null
zstyle :omz:plugins:ssh-agent identities $(printf "%s " "${ssh_keys[@]}")
EOF
FOE
# Generate SSH keys script
cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/generate-ssh-key.sh >/dev/null
cat <<-EOF | tee ${KEY_SCRIPTS_DIR}/generate-ssh-key.sh >/dev/null
#!/bin/bash
LOCAL_USER_EMAIL=${LOCAL_USER_EMAIL}
HOME=${HOME}
for key in ${ssh_keys[@]}; do
@ -36,8 +35,9 @@ cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/generate-ssh-key.sh >/dev/null
EOF
# Add keys to ssh-agent script
cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/ssh-key-add.sh >/dev/null
cat <<-EOF | tee ${KEY_SCRIPTS_DIR}/ssh-key-add.sh >/dev/null
#!/bin/bash
HOME=${HOME}
eval "\$(ssh-agent -s)"
for key in ${ssh_keys[@]}; do
@ -46,8 +46,9 @@ cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/ssh-key-add.sh >/dev/null
EOF
# Set permissions for SSH keys and directories script
cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/ssh-key-permissions.sh >/dev/null
cat <<-EOF | tee ${KEY_SCRIPTS_DIR}/ssh-key-permissions.sh >/dev/null
#!/bin/bash
HOME=${HOME}
chmod 700 "\$HOME/.ssh"
chmod 644 "\$HOME/.ssh/authorized_keys"
@ -61,8 +62,9 @@ cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/ssh-key-permissions.sh >/dev/null
EOF
# Configure preferred keys for each host script
cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/ssh-config.sh >/dev/null
cat <<-EOF | tee ${KEY_SCRIPTS_DIR}/ssh-config.sh >/dev/null
#!/bin/bash
HOME=${HOME}
declare -A ssh_configs=(
["git2.ring-zero.co.uk"]="gitea_rsa"
@ -73,13 +75,13 @@ cat <<-EOF | tee "${KEY_SCRIPTS_DIR}"/ssh-config.sh >/dev/null
["salsa.debian.org"]="debian_rsa"
)
for host in "\${!ssh_configs[@]}"; do
cat <<-EOF2 | sudo tee -a "\$HOME/.ssh/config" >/dev/null
cat <<-FOE | sudo tee -a "\$HOME/.ssh/config" >/dev/null
Host \$host
User git
Preferredauthentications publickey
IdentityFile "\$HOME/.ssh/\${ssh_configs[\$host]}"
EOF2
FOE
done
EOF
@ -88,17 +90,17 @@ EOF
chmod +x ${KEY_SCRIPTS_DIR}/*.sh
# Execute scripts
# "${KEY_SCRIPTS_DIR}"/set-zstyle.sh
# "${KEY_SCRIPTS_DIR}"/generate-ssh-key.sh
# "${KEY_SCRIPTS_DIR}"/ssh-key-add.sh
# "${KEY_SCRIPTS_DIR}"/ssh-key-permissions.sh
# "${KEY_SCRIPTS_DIR}"/ssh-config.sh
"${KEY_SCRIPTS_DIR}"/set-zstyle.sh
"${KEY_SCRIPTS_DIR}"/generate-ssh-key.sh
"${KEY_SCRIPTS_DIR}"/ssh-key-add.sh
"${KEY_SCRIPTS_DIR}"/ssh-key-permissions.sh
"${KEY_SCRIPTS_DIR}"/ssh-config.sh
# Generate system keys
ssh-keygen -A
# Generate root user keys if not present
if [ ! -f "${HOME}"/.ssh/id_rsa.pub ]; then
ssh-keygen -q -t rsa -N '' -f "${HOME}"/.ssh/id_rsa 2>/dev/null <<< y >/dev/null
chmod 644 "${HOME}"/.ssh/id_rsa.pub
if [ ! -f ${HOME}/.ssh/id_rsa.pub ]; then
ssh-keygen -q -t rsa -N '' -f "${HOME}"/.ssh/id_rsa 2>/dev/null <<<y >/dev/null
chmod 644 "${HOME}"/.ssh/id_rsa.pub
fi

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# https://docs.docker.com/build/building/multi-platform/#qemu-without-docker-desktop
echo "Before:"

View File

@ -60,7 +60,8 @@ arm64)
EXTENSION="Debian12.arm64.deb"
;;
armhf)
EXTENSION="Debian12.armhf.deb"
EXTENSION="Debian12.armhf.deb"
;;
*)
echo "Unable to determine system architecture."
exit 1
@ -80,7 +81,8 @@ if [ $? -eq 0 ]; then
else
echo "Checksums do not match. Skipping installation."
fi
"Checksums do not match. Skipping installation."# conf_print_${PROJECT}() {
# conf_print_${PROJECT}() {
# cat <<'EOF'
# name: debian12
#
@ -345,48 +347,49 @@ fi
# EOF
# }
# # conf_print_wezterm_deploy
#
# conf_print_wezterm_theme_minimal() {
# cat <<-EOF
# local wezterm = require("wezterm")
# return {
# -- color_scheme = 'termnial.sexy',
# color_scheme = "Catppuccin Mocha",
# enable_tab_bar = false,
# font_size = 11.0,
# -- macos_window_background_blur = 40,
# macos_window_background_blur = 30,
#
# -- window_background_image = '/Users/omerhamerman/Downloads/3840x1080-Wallpaper-041.jpg',
# -- window_background_image_hsb = {
# -- brightness = 0.01,
# -- hue = 1.0,
# -- saturation = 0.5,
# -- },
# -- window_background_opacity = 0.92,
# window_background_opacity = 1.0,
# -- window_background_opacity = 0.78,
# -- window_background_opacity = 0.20,
# window_decorations = "RESIZE",
# keys = {
# {
# key = "f",
# mods = "CTRL",
# action = wezterm.action.ToggleFullScreen,
# },
# },
# mouse_bindings = {
# -- Ctrl-click will open the link under the mouse cursor
# {
# event = { Up = { streak = 1, button = "Left" } },
# mods = "CTRL",
# action = wezterm.action.OpenLinkAtMouseCursor,
# },
# },
# }
# EOF
# }
# conf_print_wezterm_theme_minimal | tee ${DEST}/.config/wezterm/wezterm.lua
WALLPAPER='${DEST}/Pictures/Wallpapers/1920x1200-Wallpaper-041.jpg'
conf_print_wezterm_theme_minimal() {
cat <<-EOF
local wezterm = require("wezterm")
return {
-- color_scheme = 'termnial.sexy',
color_scheme = "Catppuccin Mocha",
enable_tab_bar = false,
font_size = 11.0,
-- macos_window_background_blur = 40,
macos_window_background_blur = 30,
-- window_background_image = ${WALLPAPER}',
-- window_background_image_hsb = {
-- brightness = 0.01,
-- hue = 1.0,
-- saturation = 0.5,
-- },
-- window_background_opacity = 0.92,
window_background_opacity = 1.0,
-- window_background_opacity = 0.78,
-- window_background_opacity = 0.20,
window_decorations = "RESIZE",
keys = {
{
key = "f",
mods = "CTRL",
action = wezterm.action.ToggleFullScreen,
},
},
mouse_bindings = {
-- Ctrl-click will open the link under the mouse cursor
{
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = wezterm.action.OpenLinkAtMouseCursor,
},
},
}
EOF
}
conf_print_wezterm_theme_minimal | tee ${DEST}/.config/wezterm/wezterm.lua
# An extensive wezterm config, maybe too extensive, using tmux as default.
# and a complete set of aditional keymaps to learn.

36
devuan-release-keys.sh Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
case ${OS} in
devuan)
case ${DIST} in
ceres | beowulf | chimaera | daedalus)
# https://www.devuan.org/os/keyring
# Ceres, Beowulf, Chimaera and Daedalus
RELEASE_KEY="94532124541922FB"
gpg --keyserver keyring.devuan.org --recv-keys "${RELEASE_KEY}"
gpg --fingerprint ${RELEASE_KEY}
gpg --export ${RELEASE_KEY} >/tmp/devuan_key.gpg
mkdir -p ${TARGET}/etc/apt/trusted.gpg.d/
cp /tmp/devuan_key.gpg ${TARGET}/etc/apt/trusted.gpg.d/devuan_key.gpg
;;
excalibur)
# Excalibur
RELEASE_KEY="B3982868D104092C"
gpg --keyserver keyring.devuan.org --recv-keys "${RELEASE_KEY}"
gpg --fingerprint "${RELEASE_KEY}"
gpg --export ${RELEASE_KEY} >/tmp/devuan_key.gpg
mkdir -p ${TARGET}/etc/apt/trusted.gpg.d/
cp /tmp/devuan_key.gpg ${TARGET}/etc/apt/trusted.gpg.d/devuan_key.gpg
;;
freia)
RELEASE_KEY="55C470D57732684B"
gpg --keyserver keyring.devuan.org --recv-keys "${RELEASE_KEY}"
gpg --fingerprint "${RELEASE_KEY}"
gpg --export ${RELEASE_KEY} >/tmp/devuan_key.gpg
mkdir -p ${TARGET}/etc/apt/trusted.gpg.d/
cp /tmp/devuan_key.gpg ${TARGET}/etc/apt/trusted.gpg.d/devuan_key.gpg
;;
esac
*)
;;
esac

View File

@ -4,6 +4,7 @@ USERNAME="cyteen"
PASSWORD="mlpfinsonik"
DISTRIBUTION="ceres"
COMPONENT="main"
ARCH=$(dpkg --print-architecture)
GITEA_URL="https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload"
# Check if a .deb file was provided as an argument
@ -21,7 +22,7 @@ curl \
${GITEA_URL}
echo "See: automate/020_gitea_dpr.sh for sources.list creation."
echo "deb [signed-by=\${KEYRING}] https://${USERNAME}:${PASSWORD}@https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian ${DISTRIBUTION} ${COMPONENT}"
echo "deb [arch=\${ARCH} signed-by=\${KEYRING}] https://${USERNAME}:${PASSWORD}@https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian ${DISTRIBUTION} ${COMPONENT}"
# Show available packages
curl -s --url https://cyteen:mlpfinsonik@git2.ring-zero.co.uk/api/v1/packages/cyteen/ | jq '.[] | select(.type == "debian") | {type, name, version, html_url, created_at}'

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -x
USERNAME="cyteen"
PASSWORD="mlpfinsonik"
DISTRIBUTION="ceres"
COMPONENT="main"
# Extract the architecture from the filename
DEB_FILE="$1"
ARCHITECTURE="${DEB_FILE%.*}" # Remove the.deb extension to get the architecture
# Validate the architecture
if [[ $ARCHITECTURE =~ ^(amd64|arm64)$ ]]; then
echo "Invalid architecture. Must be either amd64 or arm64."
exit 1
fi
# Construct the GITEA URL based on the architecture
GITEA_URL="https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian/pool/${DISTRIBUTION}/${COMPONENT}/upload/${ARCHITECTURE}"
# Upload the specified.deb file
curl \
--user ${USERNAME}:${PASSWORD} \
--upload-file "${DEB_FILE}" \
${GITEA_URL}
# echo "See: automate/020_gitea_dpr.sh for sources.list creation."
# echo "deb [signed-by=\${KEYRING}] https://${USERNAME}:${PASSWORD}@https://git2.ring-zero.co.uk/api/packages/${USERNAME}/debian ${DISTRIBUTION} ${COMPONENT}"
# Show available packages
# curl -s --url https://cyteen:mlpfinsonik@git2.ring-zero.co.uk/api/v1/packages/cyteen/ | jq '.[] | select(.type == "debian") | {type, name, version, html_url, created_at}'