Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Execute RedOrder Scripts

on:
push:
branches:
- develop

jobs:
exec-redorder:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Execute redorder
run: |
wget -O- https://raw.githubusercontent.com/RSKYS/redorder/refs/heads/develop/redorder | sudo sh

exec-vps2deb:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Execute vps2deb
run: |
wget -O- https://raw.githubusercontent.com/RSKYS/redorder/refs/heads/develop/conf.d/vps2deb | sudo sh
38 changes: 22 additions & 16 deletions conf.d/vps2deb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ extract_and_prepare() {
INIT

( cd /tmp/build
docker-buildx build -t base_sys . )
if ! command -v docker-buildx >/dev/null 2>&1; then
DOCKER_BUILDKIT=1 \
docker build -t base_sys .
else
docker-buildx build -t base_sys . || \
echo "This script need's buildx" && exit 1
fi )

docker create --name deb_tmp base_sys
docker export deb_tmp -o /tmp/base.tar
Expand All @@ -134,17 +140,6 @@ extract_and_prepare() {
echo "nameserver 1.1.1.1" > /Debian/etc/resolv.conf
}

un_mount() {
local mn

for mn in $(awk '$2 != "/" &&
$2 !~ /^\/(boot|efi|dev|sys|proc|tmp|Debian)/ {print $2}' \
/proc/mounts | sort -r)
do
umount -l "$mn" 2>/dev/null || true
done
}

backup_old_files() {
cp -fL /etc/hostname /etc/localtime /Debian/etc/ \
2>/dev/null || true
Expand All @@ -155,15 +150,26 @@ backup_old_files() {
cleanup() {
rm -rf /boot/efi/* 2>/dev/null || true
rm -f /boot/* 2>/dev/null || true
un_mount

# Try to stop known services
for svc in docker kubelet snapd apt-daily.timer \
apt-daily.service unattended-upgrades rsyslog
do
systemctl stop "$svc" --now || true
# >/dev/null 2>&1
done

# Switch single-user & ensure root's rw
systemctl isolate rescue.target || true
mount -o remount,rw / || true
}

overwrite_system() {
cleanup

# Galactic smash
rsync -aHAX --numeric-ids --delete-after --exclude=/tmp/** \
--exclude=/dev/** --exclude=/proc/** --exclude=/sys/** \
rsync -aHAX --numeric-ids --delete-after --delay-updates \
--exclude=/tmp/** --exclude=/dev/** --exclude=/proc/** --exclude=/sys/** \
--exclude=/Debian/** --exclude=/efi/** --exclude=/boot/** \
/Debian/ / || true

Expand Down Expand Up @@ -215,7 +221,7 @@ overwrite_system() {
wamerican x11-common xkb-data cryptsetup cryptsetup-initramfs dmsetup \
efibootmgr gdisk lvm2 multipath-tools nvme-cli open-iscsi alsa-utils \
rsync sg3-utils smartmontools squashfs-tools open-vm-tools \
xfsprogs zfsutils-linux apparmor apt apt-utils ca-certificates fail2ban \
xfsprogs zfsutils-linux apparmor apt apt-utils ca-certificates \
gnupg gnupg2 gpgconf openssl p11-kit publicsuffix \
python3-apt python3-requests python3-setuptools vim-scripts \
python3-urllib3 python3-yaml sudo acpid wamerican wamerican-large \
Expand Down
Loading