Skip to content

Commit

Permalink
Merge pull request #28 from zstg/main
Browse files Browse the repository at this point in the history
Fix repo
  • Loading branch information
slipstream8125 authored Sep 22, 2024
2 parents ade5350 + 249a5ac commit 2fa2c28
Show file tree
Hide file tree
Showing 21 changed files with 122 additions and 98 deletions.
2 changes: 1 addition & 1 deletion PKGBUILDS/albert/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Contributor: Manuel Schneider <manuelschneid3r at googles mail>

pkgname=albert
pkgver=0.26.3
pkgver=0.26.2
pkgrel=1
pkgdesc="A sophisticated standalone keyboard launcher"
arch=('x86_64')
Expand Down
2 changes: 1 addition & 1 deletion PKGBUILDS/grab/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkgdesc="Definitely not a system info fetch script"
arch=('x86_64')
url="https://github.com/StratOS-Linux/grab"
license=('GPL')
depends=('gcc' 'make')
depends=('gcc' 'make' 'fakeroot')

prepare() {
cd "$srcdir"
Expand Down
214 changes: 118 additions & 96 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/bin/bash
# set -e # exit on error
# set -e
# Function to handle errors
handle_error() {
echo "Error on line $1"
exit 1
}

# Ensure GITHUB_TOKEN is set
if [ ! -d "/workspace" ] && [ "$GITHUB_TOKEN" = "" ]; then
echo "GITHUB_TOKEN is not set. Please set it - following the instructions in README.md - before running this script."
git config --global --add safe.directory /workspace
# git config --global --add safe.directory /workspace/repoctl
exit 1
fi
# Trap errors
trap 'handle_error $LINENO' ERR
[ -d /workspace ] && git config --global --add safe.directory /workspace && git config --global --add safe.directory /workspace/repoctl

# Set up Arch Linux environment
setup_environment() {
Expand All @@ -18,65 +23,132 @@ setup_environment() {
git config --global http.postBuffer 15728640000

export URL="https://$(git config --get remote.origin.url | sed -E 's|.+[:/]([^:/]+)/([^/.]+)(\.git)?|\1|').github.io/repo/x86_64"
# echo -e "\n[stratos]\nSigLevel = Optional TrustAll\nServer = $URL" | sudo tee -a /etc/pacman.conf
sudo sed -i 's/purge debug/purge !debug/g' /etc/makepkg.conf
sudo sed -i 's/^#* *GPGKEY *=.*/GPGKEY="19A421C3D15C8B7C672F0FACC4B8A73AB86B9411"/' /etc/makepkg.conf # add zstg's public key
sudo sed -i 's/^#* *GPGKEY *=.*/GPGKEY="19A421C3D15C8B7C672F0FACC4B8A73AB86B9411"/' /etc/makepkg.conf
sed -i 's/^#*\(PACKAGER=\).*/\1"StratOS team <[email protected]>"/' /etc/makepkg.conf
}

# Create dummy user for makepkg
create_dummy_user() {
dir=$PWD
sudo useradd -m builder -s /bin/bash
sudo usermod -aG wheel builder
echo '%wheel ALL=(ALL) NOPASSWD:ALL' | sudo tee -a /etc/sudoers
sudo -u builder curl -sS https://github.com/elkowar.gpg | gpg --dearmor > elkowar.gpg && sudo pacman-key --add elkowar.gpg
sudo -u builder curl -sS https://github.com/web-flow.gpg | gpg --dearmor > web-flow.gpg && sudo pacman-key --add web-flow.gpg
}

# Function to check version differences and build package
clone_and_build_if_needed() {
local package="$1"
local dir="$2"

# Get local version (from PKGBUILD if it exists)
if [ -f "$dir/PKGBUILDS/$package/PKGBUILD" ]; then
local local_version
local_version=$(grep -Po '(?<=pkgver=)[\d\w.]+' "$dir/PKGBUILDS/$package/PKGBUILD")
else
local_version="none"
fi

# Get AUR version (from AUR's .SRCINFO file)
local aur_version
aur_version=$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/.SRCINFO?h=$package" | grep -Po '(?<=pkgver = )[\d\w.]+')

echo "Checking $package: local version = $local_version, AUR version = $aur_version"

# Only clone and build if versions differ
if [ "$local_version" != "$aur_version" ]; then
git clone https://aur.archlinux.org/"$package".git
sudo chmod -R 777 ./"$package"
cd "$package"
mkdir -p "$dir/PKGBUILDS/$package/"
cp PKGBUILD "$dir/PKGBUILDS/$package"/PKGBUILD
sudo -u builder makepkg -cfs --noconfirm
# rm -rf "$dir/x86_64/$package"**.pkg.tar.zst
mv *.pkg.tar.zst "$dir"/x86_64/
cd ..
rm -rf "$package"
else
echo "$package is on latest AUR version, doesn't need a rebuild"
fi
}

# Build and package software
build_and_package() {
sudo pacman -Sy
sudo pacman -S fakeroot --noconfirm
dir="$PWD"
sudo git config --global init.defaultBranch main

local packages=(
"albert"
"aura-bin"
# "aurutils"
"bibata-cursor-theme-bin"
# "brave-bin"
# #"eww"
# "google-chrome"
# "gruvbox-plus-icon-theme-git"
# "libadwaita-without-adwaita-git"
# "mkinitcpio-openswap"
# "nwg-clipman"
"nwg-dock-hyprland-bin"
# "octopi"
"oh-my-zsh-git"
# "pamac-all"
"pandoc-bin"
"python-clickgen"
# "pyprland"
# #"repoctl"
# "rua"
"swayfx"
# "sway-nvidia"
"swayosd-git"
"ventoy-bin"
"yay-bin"
)

for i in "${packages[@]}"; do
clone_and_build_if_needed "$i" "$dir"
done

# # sudo pacman -U $dir/x86_64/ckbcomp-1.227-1-any.pkg.tar.zst --noconfirm
# sudo pacman -U $dir/x86_64/repoctl-0.22.2-1-x86_64.pkg.tar.zst --noconfirm
# cd $dir/PKGBUILDS/rockers/
# sudo chmod -R 777 ../rockers
# sudo -u builder makepkg -cfs --noconfirm # --sign
# rm -f **debug**.pkg.tar.zst
# rm -rf src/ pkg/
# mv *.pkg.tar.zst $dir/x86_64/
# cd $dir/

# mkdir -p /tmp/litefm && chmod -R 777 /tmp/litefm
# cp $dir/PKGBUILDS/litefm/PKGBUILD /tmp/litefm
# cd /tmp/litefm
# rm -f $dir/x86_64/**litefm**.pkg.tar.zst
# sudo -u builder makepkg -cfs --noconfirm # --sign
# mv *.pkg.tar.zst $dir/x86_64/
# cd $dir/

# mkdir -p /tmp/ckbcomp
# cp $dir/PKGBUILDS/ckbcomp/PKGBUILD /tmp/ckbcomp
# cd /tmp/ckbcomp
# sudo chmod -R 777 /tmp/ckbcomp
# sudo -u builder makepkg -cfs --noconfirm
# rm -f **debug**.pkg.tar.zst
# cp *.pkg.tar.zst $dir/x86_64/
# sudo pacman -U *.pkg.tar.zst --noconfirm
# cd $dir

# cd "$dir"/PKGBUILDS/calamares
# sudo chmod -R 777 "$dir"/PKGBUILDS/calamares
# sudo -u builder makepkg -cfs --noconfirm # --sign
# echo "Removing Qt Calamares build..."
# sudo rm -v **qt5**.pkg.tar.zst
# sudo rm -rfv *.tar.gz **debug**.pkg.tar.zst calamares/ src/ pkg/
# rm -fv "$dir"/x86_64/**calamares**.pkg.tar.zst
# mv -v *.pkg.tar.zst "$dir"/x86_64/
# cd "$dir"
cd $dir/PKGBUILDS/rockers/
sudo chmod -R 777 ../rockers
sudo -u builder makepkg -cfs --noconfirm # --sign
rm -f **debug**.pkg.tar.zst
rm -rf src/ pkg/
mv *.pkg.tar.zst $dir/x86_64/
cd $dir/

mkdir -p /tmp/litefm && chmod -R 777 /tmp/litefm
cp $dir/PKGBUILDS/litefm/PKGBUILD /tmp/litefm
cd /tmp/litefm
rm -f $dir/x86_64/**litefm**.pkg.tar.zst
sudo -u builder makepkg -cfs --noconfirm # --sign
mv *.pkg.tar.zst $dir/x86_64/
cd $dir/

mkdir -p /tmp/ckbcomp
cp $dir/PKGBUILDS/ckbcomp/PKGBUILD /tmp/ckbcomp
cd /tmp/ckbcomp
sudo chmod -R 777 /tmp/ckbcomp
sudo -u builder makepkg -cfs --noconfirm
rm -f **debug**.pkg.tar.zst
cp *.pkg.tar.zst $dir/x86_64/
sudo pacman -U *.pkg.tar.zst --noconfirm
cd $dir

cd "$dir"/PKGBUILDS/calamares
sudo chmod -R 777 "$dir"/PKGBUILDS/calamares
sudo -u builder makepkg -cfs --noconfirm # --sign
echo "Removing Qt Calamares build..."
sudo rm -v **qt5**.pkg.tar.zst
sudo rm -rfv *.tar.gz **debug**.pkg.tar.zst calamares/ src/ pkg/
rm -fv "$dir"/x86_64/**calamares**.pkg.tar.zst
mv -v *.pkg.tar.zst "$dir"/x86_64/
cd "$dir"

mkdir -p /tmp/grab
cp "$dir"/PKGBUILDS/grab/PKGBUILD /tmp/grab
Expand All @@ -95,63 +167,20 @@ build_and_package() {
rm -f **debug**.pkg.tar.zst
cp *.pkg.tar.zst "$dir"/x86_64/
cd "$dir"

local packages=(
"albert"
"aura-bin"
# "aurutils"
"bibata-cursor-theme-bin"
# "brave-bin"
# #"eww"
# "google-chrome"
# "gruvbox-plus-icon-theme-git"
# "libadwaita-without-adwaita-git"
# "mkinitcpio-openswap"
# "nwg-clipman"
"nwg-dock-hyprland-bin"
# "octopi"
"oh-my-zsh-git"
"pamac-all"
"pandoc-bin"
"python-clickgen"
# "pyprland"
# #"repoctl"
# "rua"
"swayfx"
"sway-nvidia"
"swayosd-git"
"ventoy-bin"
"yay-bin"
)

for i in "${packages[@]}"; do
git clone https://aur.archlinux.org/"$i"
sudo chmod -R 777 ./"$i"
cd "$i"
mkdir -p "$dir/PKGBUILDS/$i"/
cp PKGBUILD "$dir/PKGBUILDS/$i"/PKGBUILD
sudo -u builder makepkg -cfs --noconfirm # --sign
rm -rf "$dir/x86_64/$i"**.pkg.tar.zst
mv *.pkg.tar.zst "$dir"/x86_64/
cd ..
rm -rf "$i"
done
# sudo pacman -U $dir/x86_64/**repoctl** --noconfirm
# sudo pacman -U $dir/x86_64/**aurutils** --noconfirm

}

# Initialize and push to GitHub
initialize_and_push() {
export URL="$(git config --get remote.origin.url | sed -E 's|.+[:/]([^:/]+)/([^/.]+)(\.git)?|\1|')"
export URL="$(git config --get remote.origin.url | sed -E 's|.+[:/]([^:/]+)/([^/.]+)(\.git)?|\1/\2|')"
cd "$dir"
bash ./initialize.sh
git config --global --add safe.directory /workspace # unnecessary
repo-remove x86_64/stratos.db.tar.gz
repo-add -R x86_64/stratos.db.tar.gz x86_64/*.pkg.tar.zst
sudo git config --global user.name 'github-actions[bot]'
sudo git config --global user.email 'github-actions[bot]@users.noreply.github.com'
sudo git add .
sudo git commit -am "Update packages"
# sudo git pull
sudo git push "https://x-access-token:${GITHUB_TOKEN}@github.com/$URL/repo" --force
sudo git push "https://x-access-token:${GITHUB_TOKEN}@github.com/$URL" --force
}

# Main function
Expand All @@ -161,12 +190,5 @@ main() {
build_and_package
initialize_and_push
}

# Ensure GITHUB_TOKEN is set
if [ ! -d "/workspace" ] && [ "$GITHUB_TOKEN" = "" ]; then
echo "GITHUB_TOKEN is not set. Please set it - following the instructions in README.md - before running this script."
exit 1
fi

# Execute main function
main
Binary file added x86_64/albert-0.26.3-1-x86_64.pkg.tar.zst
Binary file not shown.
Binary file modified x86_64/aura-bin-4.0.7-1-x86_64.pkg.tar.zst
Binary file not shown.
Binary file modified x86_64/bibata-cursor-theme-bin-2.0.7-1-any.pkg.tar.zst
Binary file not shown.
Binary file modified x86_64/grab-1.0-4-x86_64.pkg.tar.zst
Binary file not shown.
Binary file modified x86_64/maneki-neko-1.0.0-1-x86_64.pkg.tar.zst
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified x86_64/pandoc-bin-3.4-1-x86_64.pkg.tar.zst
Binary file not shown.
Binary file added x86_64/python-clickgen-2.2.5-1-any.pkg.tar.zst
Binary file not shown.
1 change: 1 addition & 0 deletions x86_64/stratos.db
Binary file added x86_64/stratos.db.tar.gz
Binary file not shown.
Binary file added x86_64/stratos.db.tar.xz
Binary file not shown.
1 change: 1 addition & 0 deletions x86_64/stratos.files
Binary file added x86_64/stratos.files.tar.gz
Binary file not shown.
Binary file added x86_64/stratos.files.tar.xz
Binary file not shown.
Binary file added x86_64/sway-nvidia-1.0.7-1-any.pkg.tar.zst
Binary file not shown.
Binary file added x86_64/ventoy-bin-1.0.99-1-x86_64.pkg.tar.zst
Binary file not shown.
Binary file modified x86_64/yay-bin-12.4.2-1-x86_64.pkg.tar.zst
Binary file not shown.

0 comments on commit 2fa2c28

Please sign in to comment.