updated Parch Linux Mate base

This commit is contained in:
Sohrab Behdani 2024-10-17 12:48:51 +03:30
parent 910192db12
commit 7f18ec51ed
5 changed files with 69 additions and 96 deletions

36
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,36 @@
stages:
- build
- deploy
image: archlinux/archlinux:base-devel
variables:
Desktop: "mate"
build_iso:
stage: build
script:
- ./build.sh
- echo "Renaming the output ISO file"
- mv out/*.iso out/ParchLinux-$Desktop-latest.iso
artifacts:
paths:
- out/ParchLinux-$Desktop-latest.iso
rules:
- if: $CI_COMMIT_TAG
deploy_iso:
stage: deploy
dependencies:
- build_iso
script:
- echo "Installing sshpass and rsync"
- pacman -Syu --noconfirm sshpass rsync
- echo "Removing old ISO files from remote directory"
- sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT rm -rf /srv/http/$Desktop/
- echo "Creating new directory on remote host"
- sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT mkdir -p /srv/http/$Desktop/
- echo "Uploading new ISO via rsync"
- sshpass -p "$PASS" rsync -r out/ParchLinux-$Desktop-latest.iso parch@$SSH_ROOT:/srv/http/$Desktop/
rules:
- if: $CI_COMMIT_TAG

View file

@ -2,7 +2,7 @@
main() { main() {
set -e set -e
local Black DarkGray Red LightRed Green LightGreen Brown Yellow Blue LightBlue Purple Light Purple Cyan LightCyan LightGray White reset local Black DarkGray Red LightRed Green LightGreen Brown Yellow Blue LightBlue Purple Light Purple Cyan LightCyan LightGray White reset
## save colors ## Save colors
Black="\e[0;30m" Black="\e[0;30m"
DarkGray="\e[1;30m" DarkGray="\e[1;30m"
Red="\e[0;31m" Red="\e[0;31m"
@ -23,38 +23,34 @@ main() {
local reponame local reponame
reponame=${PWD##*/} reponame=${PWD##*/}
echo -e "$Green### start install packeges for build $reponame ###$reset" echo -e "$Green### Start install packages for build $reponame ###$reset"
echo -e "$Brown### checking your os ###$reset" echo -e "$Brown### Checking your OS ###$reset"
if type pacman >/dev/null 2>&1;then if type pacman >/dev/null 2>&1;then
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
echo -e "$Red### you are not in root$reset" echo -e "$Red### You are not in root$reset"
exit 1 exit 1
else else
install install
echo -e "$Blue### install complete ###$reset" echo -e "$Blue### Install complete ###$reset"
echo -e "$Green### start build $reponame with archiso ###$reset" echo -e "$Green### Start build $reponame with archiso ###$reset"
build build
makezip
fi fi
else else
echo -e "$Red###os cant supported###$reset" echo -e "$Red###OS can't supported###$reset"
exit 1 exit 1
fi fi
} }
install() { install() {
set -e set -e
pacman -Sy; pacman --noconfirm -S --needed git archiso github-cli p7zip pacman -Sy; pacman --noconfirm -S --needed git archiso github-cli p7zip reflector rsync
} }
build() { build() {
set -e set -e
mkarchiso -v iso/ mkarchiso -v iso/
} }
makezip() {
cd out
7z -v500m a "$(ls *.iso)".zip "$(ls *.iso)"
md5sum * > md5sums.txt
}
main main

View file

@ -35,10 +35,13 @@ Architecture = auto
CheckSpace CheckSpace
#VerbosePkgLists #VerbosePkgLists
#ParallelDownloads = 5 #ParallelDownloads = 5
DownloadUser = alpm
# By default, pacman accepts packages signed by keys that its local keyring # By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages. # trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional SigLevel = Never
LocalFileSigLevel = Optional LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required #RemoteFileSigLevel = Required
@ -72,6 +75,10 @@ LocalFileSigLevel = Optional
#[core-testing] #[core-testing]
#Include = /etc/pacman.d/mirrorlist #Include = /etc/pacman.d/mirrorlist
[ppr]
SigLevel = Optional TrustedOnly
Server = https://git.parchlinux.com/repo/ppr/-/raw/main/x86_64/
[core] [core]
Include = /etc/pacman.d/mirrorlist Include = /etc/pacman.d/mirrorlist
@ -87,16 +94,13 @@ Include = /etc/pacman.d/mirrorlist
#[multilib-testing] #[multilib-testing]
#Include = /etc/pacman.d/mirrorlist #Include = /etc/pacman.d/mirrorlist
[multilib] #[multilib]
Include = /etc/pacman.d/mirrorlist #Include = /etc/pacman.d/mirrorlist
[ppr]
SigLevel = Optional TrustedOnly
Server = https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/
[pcp] [pcp]
SigLevel = Optional TrustedOnly SigLevel = Optional TrustedOnly
Server = https://raw.githubusercontent.com/parchlinux/pcp/main/x86_64/ Server = https://git.parchlinux.com/repo/pcp/-/raw/main/x86_64/
# An example of a custom package repository. See the pacman manpage for # An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories. # tips on creating your own repositories.

View file

@ -1,24 +1,26 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC2034 # shellcheck disable=SC2034
iso_name="Parchlinux Mate" iso_name="Parch Linux Mate"
iso_label="PARCH_LINUX_MATE_$(date +%Y%m)" iso_label="ParchLinux_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)"
iso_publisher="Parch Linux <https://parchlinux.ir>" iso_publisher="Parch Linux <https://Parchlinux.com>"
iso_application="Parch Linux Live/Rescue CD" iso_application="Parch Linux Live/Rescue DVD"
iso_version="$(date +%Y.%m.%d)" iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
install_dir="arch" install_dir="arch"
buildmodes=('iso') buildmodes=('iso')
bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito'
'uefi-x64.systemd-boot.esp' 'uefi-ia32.systemd-boot.esp' 'uefi-x64.systemd-boot.esp'
'uefi-x64.systemd-boot.eltorito') 'uefi-ia32.systemd-boot.eltorito' 'uefi-x64.systemd-boot.eltorito')
arch="x86_64" arch="x86_64"
pacman_conf="pacman.conf" pacman_conf="pacman.conf"
airootfs_image_type="squashfs" airootfs_image_type="squashfs"
airootfs_image_tool_options=('-comp' 'xz' '-Xbcj' 'x86' '-b' '1M' '-Xdict-size' '1M') airootfs_image_tool_options=('-comp' 'xz' '-Xbcj' 'x86' '-b' '1M' '-Xdict-size' '1M')
bootstrap_tarball_compression=('zstd' '-c' '-T0' '--auto-threads=logical' '--long' '-19')
file_permissions=( file_permissions=(
["/etc/shadow"]="0:0:400" ["/etc/shadow"]="0:0:400"
["/root"]="0:0:750" ["/root"]="0:0:750"
["/root/.automated_script.sh"]="0:0:755" ["/root/.automated_script.sh"]="0:0:755"
["/root/.gnupg"]="0:0:700"
["/usr/local/bin/choose-mirror"]="0:0:755" ["/usr/local/bin/choose-mirror"]="0:0:755"
["/usr/local/bin/Installation_guide"]="0:0:755" ["/usr/local/bin/Installation_guide"]="0:0:755"
["/usr/local/bin/livecd-sound"]="0:0:755" ["/usr/local/bin/livecd-sound"]="0:0:755"

View file

@ -1,65 +0,0 @@
import hashlib
import logging
import os
import sys
from datetime import datetime
from pathlib import Path
from github import Github
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
api_key = os.getenv("API_KEY", None)
current_date = datetime.today().strftime("%Y-%m-%d")
def _compute_sha256(file_name):
hash_sha256 = hashlib.sha256()
with open(file_name, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_sha256.update(chunk)
return hash_sha256.hexdigest()
_path = list(Path().cwd().glob("out/*.iso"))[0]
path = _path.as_posix()
file_name = _path.name
hash = _compute_sha256(path)
repo_name = os.getenv("REPO_NAME", None)
release_name = os.getenv("RELEASE_NAME", None)
logging.info("Starting at %s", current_date)
if not (repo_name and api_key and release_name):
logging.error(
"'REPO_NAME'/'API_KEY'/'RELEASE_NAME' not found in your environment vars."
"please add this and run again."
)
sys.exit(1)
gh = Github(api_key)
print(repo_name, api_key)
repo = gh.get_repo(repo_name)
release = repo.get_release(release_name)
logging.info("Statrting upload ISO to release")
release.upload_asset(path=path)
logging.info("ISO uploaded.")
# update release
msg = (
release.body
+ f"""
| name | sha256 |
| :---: | :---: |
| {file_name} | {hash} |"""
)
logging.info("Starting update release msg with: \n %s" % msg)
release.update_release(name=release.tag_name, message=msg)
logging.info("Release update is done.")