mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
Imported usable scripts from the private temporary repository
This commit is contained in:
32
scripts/alpine/raspberrypi-headless-setup.sh
Normal file
32
scripts/alpine/raspberrypi-headless-setup.sh
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# https://wiki.alpinelinux.org/wiki/Raspberry_Pi_-_Headless_Installation
|
||||||
|
|
||||||
|
setup-ntp -c chrony
|
||||||
|
setup-keymap
|
||||||
|
setup-hostname raspberrypi
|
||||||
|
setup-timezone -z Europe/Amsterdam
|
||||||
|
setup-lbu -q
|
||||||
|
setup-apkcache
|
||||||
|
setup-apkrepos
|
||||||
|
|
||||||
|
apk add rng-tools
|
||||||
|
rc-update add rngd boot
|
||||||
|
# rc-update add wpa_supplicant boot
|
||||||
|
rc-update add urandom boot
|
||||||
|
|
||||||
|
mount -o remount,rw /media/mmcblk0p1
|
||||||
|
rm /media/mmcblk0p1/headless.apkovl.tar.gz
|
||||||
|
rm /media/mmcblk0p1/wifi.txt
|
||||||
|
|
||||||
|
rc-update del local default
|
||||||
|
rm /etc/local.d/headless.start
|
||||||
|
|
||||||
|
passwd
|
||||||
|
|
||||||
|
adduser mek
|
||||||
|
apk add sudo
|
||||||
|
echo "mek ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/mek
|
||||||
|
|
||||||
|
lbu commit -d
|
||||||
|
reboot
|
||||||
5
scripts/archlinux/blender-install.sh
Normal file
5
scripts/archlinux/blender-install.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
pacman --noconfirm \
|
||||||
|
--sync --needed --noprogressbar --quiet --refresh \
|
||||||
|
blender
|
||||||
5
scripts/archlinux/firefox-install.sh
Normal file
5
scripts/archlinux/firefox-install.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
sudo pacman --noconfirm \
|
||||||
|
--sync --needed --noprogressbar --quiet --refresh \
|
||||||
|
firefox
|
||||||
11
scripts/archlinux/kde-install.sh
Normal file
11
scripts/archlinux/kde-install.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sudo pacman --noconfirm \
|
||||||
|
--sync --needed --noprogressbar --quiet --refresh \
|
||||||
|
dolphin-plugins konsole plasma-desktop sddm \
|
||||||
|
noto-fonts noto-fonts-cjk phonon-qt5-vlc \
|
||||||
|
breeze-gtk discover drkonqi kdegraphics-thumbnailers kimageformats kinfocenter kscreen kwalletmanager packagekit-qt5 plasma-nm powerdevil pulseaudio xdg-desktop-portal-kde
|
||||||
|
sudo systemctl set-default graphical.target
|
||||||
|
sudo systemctl enable --now NetworkManager.service
|
||||||
|
sudo systemctl enable --now sddm.service
|
||||||
|
sudo pacman --noconfirm --sync --clean --clean
|
||||||
8
scripts/archlinux/xfce4-install.sh
Normal file
8
scripts/archlinux/xfce4-install.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sudo pacman --noconfirm \
|
||||||
|
--sync --needed --refresh --noprogressbar \
|
||||||
|
xfce4 xfce4-goodies lightdm-gtk-greeter
|
||||||
|
sudo systemctl set-default graphical.target
|
||||||
|
sudo systemctl enable --now lightdm
|
||||||
|
sudo pacman --noconfirm --sync --clean --clean
|
||||||
12
scripts/decrypt-files-in-repo.sh
Executable file
12
scripts/decrypt-files-in-repo.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
TOP_LEVEL="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
echo "Decrypting files…"
|
||||||
|
|
||||||
|
find "${TOP_LEVEL}/${1}" \
|
||||||
|
-type f \
|
||||||
|
-name '*.gpg' \
|
||||||
|
-exec gpg --batch --decrypt-files --yes "{}" +
|
||||||
|
|
||||||
|
echo "Files decrypted"
|
||||||
17
scripts/k3s/install.sh
Normal file
17
scripts/k3s/install.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# https://k3s.io/
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
curl "https://github.com/k3s-io/k3s/releases/download/v1.19.7%2Bk3s1/k3s" \
|
||||||
|
--location \
|
||||||
|
--remote-name
|
||||||
|
|
||||||
|
sudo k3s server &
|
||||||
|
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
|
||||||
|
sudo k3s kubectl get node
|
||||||
|
|
||||||
|
# On a different node run the below.
|
||||||
|
# NODE_TOKEN comes from /var/lib/rancher/k3s/server/node-token on your server
|
||||||
|
sudo k3s agent --server https://myserver:6443 --token ${NODE_TOKEN}
|
||||||
16
scripts/keybase/clone-lfs-enabled-repo.bash
Executable file
16
scripts/keybase/clone-lfs-enabled-repo.bash
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
[[ $DEBUG ]] && set -x
|
||||||
|
|
||||||
|
: ${REPO_URL:?not set}
|
||||||
|
DESTINATION_DIR="${DESTINATION_DIR:-$PWD}"
|
||||||
|
|
||||||
|
git clone --no-checkout \
|
||||||
|
"${REPO_URL}" \
|
||||||
|
"${DESTINATION_DIR}/${REPO_URL##*/}"
|
||||||
|
cd "${DESTINATION_DIR}/${REPO_URL##*/}"
|
||||||
|
keybase git lfs-config
|
||||||
|
git checkout --force HEAD
|
||||||
|
cd -
|
||||||
|
|
||||||
|
[[ $DEBUG ]] && set +x
|
||||||
13
scripts/keybase/install.sh
Normal file
13
scripts/keybase/install.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
# https://keybase.io/docs/the_app/install_linux
|
||||||
|
|
||||||
|
curl https://prerelease.keybase.io/keybase_amd64.deb \
|
||||||
|
--output /tmp/keybase_amd64.deb \
|
||||||
|
--silent
|
||||||
|
LC_ALL='C' sudo apt install --assume-yes /tmp/keybase_amd64.deb
|
||||||
|
rm keybase_amd64.deb
|
||||||
|
|
||||||
|
run_keybase
|
||||||
|
|
||||||
|
# sudo dnf install --assumeyes https://prerelease.keybase.io/keybase_amd64.rpm
|
||||||
|
# sudo yum install --assumeyes https://prerelease.keybase.io/keybase_amd64.rpm
|
||||||
11
scripts/keybase/oneshot-list-git-repos.sh
Normal file
11
scripts/keybase/oneshot-list-git-repos.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
export \
|
||||||
|
KEYBASE_USERNAME="${KEYBASE_USERNAME:?not set}" \
|
||||||
|
KEYBASE_PAPERKEY="${KEYBASE_PAPERKEY:?not set}"
|
||||||
|
|
||||||
|
source install.sh
|
||||||
|
|
||||||
|
run_keybase
|
||||||
|
keybase oneshot
|
||||||
|
keybase git list
|
||||||
12
scripts/move-to-zsh.sh
Normal file
12
scripts/move-to-zsh.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
sudo pamac install fzf oh-my-zsh zsh zsh-autosuggestions zsh-syntax-highlighting
|
||||||
|
# sudo dnf install zsh-syntax-highlighting zsh-autosuggestions fzf
|
||||||
|
|
||||||
|
chsh --shell $(which zsh) $USER
|
||||||
|
cp --backup /usr/share/oh-my-zsh/zshrc ~/.zshrc
|
||||||
|
|
||||||
|
sed -Ei 's/#*\s*(ZSH_THEME)=.*/\1="refined"/' ~/.zshrc
|
||||||
|
sed -Ei 's/#*\s*(COMPLETION_WAITING_DOTS)=.*/\1="true"/' ~/.zshrc
|
||||||
|
sed -Ei 's/#*\s*(HIST_STAMPS)=.*/\1="yyyy-mm-dd"/' ~/.zshrc
|
||||||
|
# set plugins=() to (git minikube terraform)
|
||||||
6
scripts/opensuse/chromium.sh
Normal file
6
scripts/opensuse/chromium.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# sources:
|
||||||
|
# - https://forums.opensuse.org/showthread.php/538576-Installing-Vivaldi-browser-(based-on-a-Chromium)-into-the-openSUSE
|
||||||
|
|
||||||
|
sudo zypper --non-interactive install chromium
|
||||||
11
scripts/opensuse/dropbox.sh
Normal file
11
scripts/opensuse/dropbox.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# sources:
|
||||||
|
# - https://www.dropbox.com/install-linux
|
||||||
|
|
||||||
|
# No packages available
|
||||||
|
# Headless installation needed
|
||||||
|
|
||||||
|
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
|
||||||
|
cd bin && wget -O dropbox.py "https://www.dropbox.com/download?dl=packages/dropbox.py" && chmod u+x dropbox.py && cd -
|
||||||
|
dropbox.py start # or ~/.dropbox-dist/dropboxd
|
||||||
10
scripts/opensuse/keybase.sh
Normal file
10
scripts/opensuse/keybase.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# sources:
|
||||||
|
# - https://software.opensuse.org/download/package?package=keybase-client&project=openSUSE%3AFactory
|
||||||
|
|
||||||
|
# sudo zypper addrepo --refresh https://download.opensuse.org/repositories/openSUSE:Factory/standard/openSUSE:Factory.repo
|
||||||
|
sudo zypper --non-interactive install git-lfs
|
||||||
|
sudo zypper --non-interactive install keybase-client
|
||||||
|
|
||||||
|
keybase login mek
|
||||||
8
scripts/opensuse/pi.config.sh
Normal file
8
scripts/opensuse/pi.config.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
USER_FULL_NAME='Mek'
|
||||||
|
USER_NAME='mek'
|
||||||
|
USER_PASSWORD="${USER_PASSWORD:?'not set'}"
|
||||||
|
USER_TYPE='local'
|
||||||
|
|
||||||
|
yast users add batchmode verbose type="${USER_TYPE}" username="${USER_NAME}" password="${USER_PASSWORD}" cn="${USER_FULL_NAME}"
|
||||||
14
scripts/opensuse/post-install.sh
Normal file
14
scripts/opensuse/post-install.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# sources:
|
||||||
|
# - https://en.opensuse.org/Additional_package_repositories
|
||||||
|
|
||||||
|
sudo zypper --non-interactive install ansible dolphin-plugins
|
||||||
|
|
||||||
|
# sudo zypper addrepo --check --refresh --priority 90 'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_$releasever/' packman
|
||||||
|
sudo zypper addrepo --check --refresh --priority 90 https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/ packman
|
||||||
|
|
||||||
|
sudo zypper addrepo --check --refresh --priority 90 https://download.opensuse.org/repositories/mozilla/openSUSE_Tumbleweed/ mozilla
|
||||||
|
|
||||||
|
./chromium.sh
|
||||||
|
./keybase.sh
|
||||||
8
scripts/opensuse/vivaldi.sh
Normal file
8
scripts/opensuse/vivaldi.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# sources:
|
||||||
|
# - https://forums.opensuse.org/showthread.php/538576-Installing-Vivaldi-browser-(based-on-a-Chromium)-into-the-openSUSE
|
||||||
|
|
||||||
|
sudo zypper addrepo --refresh https://repo.vivaldi.com/archive/vivaldi-suse.repo
|
||||||
|
# sudo zypper repos --sort-by-priority
|
||||||
|
sudo zypper --non-interactive install vivaldi-stable
|
||||||
7
scripts/opensuse/zfs.sh
Normal file
7
scripts/opensuse/zfs.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# sources:
|
||||||
|
# - https://en.opensuse.org/OpenZFS
|
||||||
|
|
||||||
|
sudo zypper addrepo --refresh https://download.opensuse.org/repositories/filesystems/openSUSE_Tumbleweed/filesystems.repo
|
||||||
|
sudo zypper install zfs
|
||||||
26
scripts/raspbian/boinc_client.bash
Normal file
26
scripts/raspbian/boinc_client.bash
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install --assume-yes boinc-client boinctui
|
||||||
|
|
||||||
|
BAM="http://bam.boincstats.com/"
|
||||||
|
|
||||||
|
ACCT_MGR_URL="${ACCT_MGR_URL:-$BAM}"
|
||||||
|
ACCT_MGR_USERNAME="${ACCT_MGR_USERNAME}"
|
||||||
|
ACCT_MGR_PASSWORD="${ACCT_MGR_PASSWORD}"
|
||||||
|
|
||||||
|
boinccmd --acct_mgr attach "${ACCT_MGR_URL}" "${ACCT_MGR_USERNAME}" "${ACCT_MGR_PASSWORD}"
|
||||||
|
|
||||||
|
## /var/lib/boinc/cc_config.xml
|
||||||
|
# …
|
||||||
|
# <allow_remote_gui_rpc>1</allow_remote_gui_rpc> # add this
|
||||||
|
# </log_flags>
|
||||||
|
# </cc_config>
|
||||||
|
##
|
||||||
|
|
||||||
|
## /var/lib/boinc/remote_hosts.cfg
|
||||||
|
## network addresses do not work, only single hosts
|
||||||
|
# 192.168.0.190 # mb-laptop
|
||||||
|
##
|
||||||
15
scripts/raspbian/compile-git.sh
Normal file
15
scripts/raspbian/compile-git.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# https://linuxize.com/post/how-to-install-git-on-raspberry-pi/
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext
|
||||||
|
|
||||||
|
cd /usr/src/
|
||||||
|
sudo wget https://github.com/git/git/archive/refs/tags/v2.33.0.tar.gz -O git.tar.gz
|
||||||
|
sudo tar -xf git.tar.gz
|
||||||
|
cd git-*
|
||||||
|
sudo make prefix=/usr/local all
|
||||||
|
sudo make prefix=/usr/local install
|
||||||
|
|
||||||
|
git --version
|
||||||
10
scripts/raspbian/docker.bash
Normal file
10
scripts/raspbian/docker.bash
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
sudo curl -fsSL https://get.docker.com | sh -
|
||||||
|
sudo usermod -aG docker ${USER}
|
||||||
|
|
||||||
|
# logout && login to apply the new status
|
||||||
|
|
||||||
|
docker run --rm --name test hello-world && docker rmi hello-world
|
||||||
36
scripts/raspbian/salt_and_other_stuff.bash
Normal file
36
scripts/raspbian/salt_and_other_stuff.bash
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
!#/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt upgrade
|
||||||
|
sudo apt install salt-master salt-minion
|
||||||
|
sudo chown -R salt:salt /var/lib/salt
|
||||||
|
sudo gpasswd -a pi salt
|
||||||
|
passwd
|
||||||
|
sudo hostnamectl set-hostname pi4.lan
|
||||||
|
sudo vim.tiny /etc/salt/minion.d/master.conf
|
||||||
|
sudo rm /etc/salt/minion_id
|
||||||
|
sudo shutdown -r now
|
||||||
|
sudo salt-key --list all
|
||||||
|
sudo timedatectl set-timezone Europe/Dublin
|
||||||
|
sudo timedatectl status
|
||||||
|
sudo salt-key --list all
|
||||||
|
sudo salt-key --accept pi4.lan
|
||||||
|
sudo systemctl enable --now ssh.service
|
||||||
|
sudo curl -fsSL https://get.docker.com | sh -
|
||||||
|
sudo usermod -aG docker ${USER}
|
||||||
|
docker run --rm --name test hello-world
|
||||||
|
docker rmi hello-world
|
||||||
|
sudo apt install docker-compose
|
||||||
|
mkdir -p docker/boinc-client docker/pi-hole docker/nextcloud
|
||||||
|
cd docker/boinc-client
|
||||||
|
vim.tiny docker-compose.yml
|
||||||
|
docker-compose up -d
|
||||||
|
docker-compose logs --follow
|
||||||
|
cd ../pi-hole
|
||||||
|
vim.tiny docker-compose.yml
|
||||||
|
docker-compose up -d
|
||||||
|
docker-compose logs -f
|
||||||
|
sudo vim.tiny /etc/locale.gen
|
||||||
|
sudo locale-gen
|
||||||
|
sudo localectl set-locale LANG=en_IE.utf8 LANGUAGE=en_IE.utf8
|
||||||
|
mkdir -p repositories/private
|
||||||
18
scripts/render-jinja2-template.py
Normal file
18
scripts/render-jinja2-template.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys, yaml
|
||||||
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
root_dir = sys.argv[1]
|
||||||
|
template_filename = sys.argv[2]
|
||||||
|
yaml_filename = sys.argv[3]
|
||||||
|
|
||||||
|
with open('{}/{}'.format(root_dir, yaml_filename)) as y:
|
||||||
|
config_data = yaml.safe_load(y)
|
||||||
|
# print(config_data)
|
||||||
|
|
||||||
|
env = Environment(loader = FileSystemLoader(root_dir), trim_blocks=True, lstrip_blocks=True)
|
||||||
|
template = env.get_template(template_filename)
|
||||||
|
|
||||||
|
print(template.render(config_data))
|
||||||
Reference in New Issue
Block a user