Skip to content

Commit a544e40

Browse files
committed
add scripts to control
1 parent 0524dbc commit a544e40

File tree

14 files changed

+99
-87
lines changed

14 files changed

+99
-87
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ jobs:
5151
id: build
5252
run: |
5353
sed -i "s,^Description:,Files:$(find . -type f | grep -oP '(?<=^\./).*' | grep -vP '^(\.|debian/)' | while read -r file; do echo -e " $file /opt/closure/$file"; done | grep -oP '.*(?=/)' | awk -v ORS='\\n' '1')Description:," debian/control
54-
sed -i "s,^Files:,Files:$(find . -type f | grep -oP '(?<=^\./).*' | grep -P '(?<=^debian/).+' | while read -r file; do echo -e " $file /opt/closure/DEBIAN/$file"; done | grep -oP '.*(?=/)' | awk -v ORS='\\n' '1')," debian/control
54+
sed -i "s,^Files:,Files:$(find . -type f | grep -oP '(?<=^\./).*' | grep -oP '(?<=^debian/).+' | while read -r file; do echo -e " debian/$file /opt/closure/debian/$file"; done | grep -oP '.*(?=/)' | awk -v ORS='\\n' '1')," debian/control
5555
sudo apt-get update
5656
sudo apt-get install -y equivs
57-
equivs-build debian/control
57+
sudo equivs-build debian/control
5858
echo -e "built=$?\ntag=$(grep -oP '(?<=^Version: ).*' debian/control)\nmessage=$(git log -1 --pretty=%B)\n" >> "$GITHUB_OUTPUT"
5959
6060
- name: Create release

bs.sh

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,96 @@
11
#!/bin/bash
2+
# shellcheck disable=SC1091,SC2009,SC2015
3+
4+
sudonot() {
5+
# shellcheck disable=SC2068
6+
if command -v sudo >/dev/null; then
7+
sudo -E "${@:-:}" || "${@:-:}"
8+
else
9+
"${@:-:}"
10+
fi
11+
}
12+
13+
apt_install() {
14+
if ! dpkg -s "$@" &>/dev/null; then
15+
sudonot apt-get update
16+
export DEBIAN_FRONTEND=noninteractive
17+
sudonot apt-get install -yqq "$@"
18+
DEBIAN_FRONTEND=
19+
fi
20+
}
21+
22+
this_dir=$(dirname "$(readlink -f "$0")")
23+
pids=$(ps -o ppid=$$)
24+
ps -aux | grep -P "^[^-]+$this_dir/bs.sh" | awk '{print $2}' | while read -r pid; do grep -q "$pid" <<<"$pids" || sudonot kill -9 "$pid" &>/dev/null; done
25+
26+
if ! dpkg -s apt-fast &>/dev/null; then
27+
sudonot add-apt-repository -y ppa:apt-fast/stable
28+
sudonot apt-get update
29+
sudonot DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-fast
30+
fi
31+
32+
if ! dpkg -s docker-ce &>/dev/null; then
33+
apt_install ca-certificates curl
34+
sudonot install -m 0755 -d /etc/apt/keyrings
35+
sudonot curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
36+
sudonot chmod a+r /etc/apt/keyrings/docker.asc
37+
echo "deb [trusted=yes arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | sudonot tee /etc/apt/sources.list.d/docker.list >/dev/null
38+
fi
39+
40+
if ! dpkg -s closure &>/dev/null; then
41+
sudonot mkdir -m 0755 -p /etc/apt/keyrings/
42+
wget -qO- https://ipitio.github.io/closure/gpg.key | gpg --dearmor | sudonot tee /etc/apt/keyrings/closure.gpg >/dev/null
43+
echo "deb [signed-by=/etc/apt/keyrings/closure.gpg] https://ipitio.github.io/closure master main" | sudonot tee /etc/apt/sources.list.d/closure.list &>/dev/null
44+
sudonot chmod 644 /etc/apt/keyrings/closure.gpg
45+
sudonot chmod 644 /etc/apt/sources.list.d/closure.list
46+
fi
47+
48+
[ ! -f /etc/apt/preferences.d/nosnap.pref ] || sudonot mv /etc/apt/preferences.d/nosnap.pref /etc/apt/preferences.d/nosnap.pref.bak
49+
sudonot systemctl disable --now whoopsie.path &>/dev/null
50+
sudonot systemctl mask whoopsie.path &>/dev/null
51+
sudonot apt-get purge -y ubuntu-report popularity-contest apport whoopsie
52+
# shellcheck disable=SC2046
53+
apt_install closure $(grep -oP '((?<=^Depends: )|(?<=^Recommends: )|(?<=^Suggests: )).*' debian/control | tr -d ',' | tr '\n' ' ')
54+
sudonot apt autoremove -y
55+
yq -V | grep -q mikefarah &>/dev/null || {
56+
[ ! -f /usr/bin/yq ] || sudonot mv -f /usr/bin/yq /usr/bin/yq.bak
57+
arch=$(uname -m)
58+
[ "$arch" = "x86_64" ] && arch="amd64" || :
59+
[ "$arch" = "aarch64" ] && arch="arm64" || :
60+
[ "$arch" = "armv7l" ] && arch="armhf" || :
61+
[ "$arch" = "armhf" ] && arch="arm" || :
62+
[[ "$arch" == "i686" || "$arch" == "i386" ]] && arch="386" || :
63+
sudonot curl -LNZo /usr/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_"$arch"
64+
sudonot chmod +x /usr/bin/yq
65+
}
66+
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
67+
flatpak install --noninteractive flathub tv.kodi.Kodi
68+
[ ! -f /.dockerenv ] || exit 0
69+
70+
# wifi performance
71+
echo "[connection]
72+
# Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable).
73+
wifi.powersave = 2
74+
" | sudonot tee /etc/NetworkManager/conf.d/wifi-powersave.conf >/dev/null
75+
sudonot cp -f /etc/NetworkManager/conf.d/wifi-powersave.conf /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
76+
[ ! -f /lib/NetworkManager/conf.d/20-connectivity-ubuntu.conf ] || sudonot sed -i "s/uri=.*$/uri=/" /lib/NetworkManager/conf.d/20-connectivity-ubuntu.conf
277

378
if grep -q Raspberry /proc/device-tree/model; then
479

580
# wifi 2.4GHz performance
6-
grep -q dtoverlay=disable-bt /boot/firmware/config.txt || echo "dtoverlay=disable-bt" | sudo tee -a /boot/firmware/config.txt >/dev/null
81+
grep -q dtoverlay=disable-bt /boot/firmware/config.txt || echo "dtoverlay=disable-bt" | sudonot tee -a /boot/firmware/config.txt >/dev/null
782

883
if [ ! -f /etc/modprobe.d/brcmfmac.conf ]; then
984
# wifi chip bug: https://github.com/raspberrypi/linux/issues/6049#issuecomment-2642566713
10-
echo "options brcmfmac roamoff=1 feature_disable=0x202000" | sudo tee /etc/modprobe.d/brcmfmac.conf >/dev/null
11-
sudo systemctl restart systemd-modules-load
85+
echo "options brcmfmac roamoff=1 feature_disable=0x202000" | sudonot tee /etc/modprobe.d/brcmfmac.conf >/dev/null
86+
sudonot systemctl restart systemd-modules-load
1287
fi
1388
fi
1489

1590
# Verbose boot
1691
if [ -f /etc/default/grub ] && grep -q "quiet splash" /etc/default/grub; then
17-
sudo sed -i 's/quiet splash//g' /etc/default/grub
18-
grep -q "GRUB_CMDLINE_LINUX_DEFAULT" /etc/default/grub || echo "GRUB_CMDLINE_LINUX_DEFAULT=\"\"" | sudo tee -a /etc/default/grub >/dev/null
19-
grep -q "nosplash debug --verbose" /etc/default/grub || echo "GRUB_CMDLINE_LINUX=\"nosplash debug --verbose\"" | sudo tee -a /etc/default/grub >/dev/null
20-
sudo update-grub
92+
sudonot sed -i 's/quiet splash//g' /etc/default/grub
93+
grep -q "GRUB_CMDLINE_LINUX_DEFAULT" /etc/default/grub || echo "GRUB_CMDLINE_LINUX_DEFAULT=\"\"" | sudonot tee -a /etc/default/grub >/dev/null
94+
grep -q "nosplash debug --verbose" /etc/default/grub || echo "GRUB_CMDLINE_LINUX=\"nosplash debug --verbose\"" | sudonot tee -a /etc/default/grub >/dev/null
95+
sudonot update-grub
2196
fi

debian/control

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ Homepage: https://github.com/ipitio/closure
44
Standards-Version: 3.9.2
55

66
Package: closure
7-
Version: 1.6.30
7+
Version: 1.7
88
Maintainer: ipitio <[email protected]>
99
Depends: curl, flatpak, gpg, hostapd, isc-dhcp-server, iw, macchanger, netplan.io, network-manager, net-tools, qrencode, rfkill, wireguard, wireless-tools, wget
1010
Recommends: containerd.io, docker-ce, docker-ce-cli, docker-buildx-plugin, docker-compose-plugin
1111
Suggests: build-essential, byobu, dkms, iperf3, nmap, tmux, traceroute, wmctrl
1212
Copyright: debian/copyright
1313
Readme: debian/README.Debian
14+
Postinst: debian/postinst
15+
Prerm: debian/prerm
1416
Links: /usr/share/doc/closure /opt/closure/debian
1517
Description: Provision a fresh Ubuntu install as a Hub, Spoke, or hybrid of both!
1618
You can run WireGuard with Docker or on the host.

debian/postinst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
2-
# shellcheck disable=SC1003,SC1091
2+
# shellcheck disable=SC1091
33

44
pushd /opt/closure || exit 1
5-
[[ ! -f /etc/rc.local || -f /etc/rc.local.bak ]] || sudo mv -f /etc/rc.local /etc/rc.local.bak
6-
cp rc.local /etc/rc.local
75
[ ! -f installed ] || rm -rf installed
6+
[[ ! -f /etc/rc.local || -f /etc/rc.local.bak ]] || sudo mv -f /etc/rc.local /etc/rc.local.bak
7+
cp -f rc.local /etc/rc.local
88
source "bs.sh"
99
popd || exit 1

debian/prerm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#!/bin/bash
22

3-
: # TODO
3+
pushd /opt/closure || exit 1
4+
[ ! -f installed ] || rm -rf installed
5+
! grep /opt/closure /etc/rc.local &>/dev/null || [ ! -f /etc/rc.local.bak ] || mv -f /etc/rc.local.bak /etc/rc.local
6+
! grep /opt/closure /etc/rc.local &>/dev/null || rm -f /etc/rc.local
7+
grep -oP '^(Files:)? [^ ]+(?= /opt/closure)' debian/control | grep -oP '(?<= ).+' | while read -r file; do [ ! -f "$file" ] || rm -f "$file"; done
8+
find . -type d -empty -delete
9+
popd || exit 1

examples/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ services:
4848
dockerfile_inline: |
4949
FROM ghcr.io/arevindh/pihole-speedtest:latest
5050
RUN apt-get install -y php-cli php-sqlite3 php-intl php-curl wget || { apt-get update && apt-get install -y php-cli php-sqlite3 php-intl php-curl wget; }
51-
RUN curl -sSLNZ https://raw.githubusercontent.com/jacklul/pihole-updatelists/master/install.sh | sudo bash -s docker
51+
RUN curl -sSLNZ https://raw.githubusercontent.com/jacklul/pihole-updatelists/pihole-v5/install.sh | sudo bash -s docker
5252
container_name: pihole
5353
restart: unless-stopped
5454
platform: linux/amd64
File renamed without changes.

kodi/userdata/addon_data/plugin.video.jellyfin/settings.xml renamed to examples/kodi/userdata/addon_data/plugin.video.jellyfin/settings.xml

File renamed without changes.

kodi/userdata/addon_data/skin.estuary/settings.xml renamed to examples/kodi/userdata/addon_data/skin.estuary/settings.xml

File renamed without changes.

0 commit comments

Comments
 (0)