From 7f18ec51ede4b77b9e9e1bfd8e15bee835d1b921 Mon Sep 17 00:00:00 2001 From: Sohrab Behdani Date: Thu, 17 Oct 2024 12:48:51 +0330 Subject: [PATCH] updated Parch Linux Mate base --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++ build.sh | 28 ++++++++----------- iso/pacman.conf | 20 +++++++------ iso/profiledef.sh | 16 ++++++----- tools/upload_asset.py | 65 ------------------------------------------- 5 files changed, 69 insertions(+), 96 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 tools/upload_asset.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..18e4375 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/build.sh b/build.sh index c865e6e..58c74c4 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ main() { set -e 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" DarkGray="\e[1;30m" Red="\e[0;31m" @@ -23,38 +23,34 @@ main() { local reponame reponame=${PWD##*/} - echo -e "$Green### start install packeges for build $reponame ###$reset" - echo -e "$Brown### checking your os ###$reset" + echo -e "$Green### Start install packages for build $reponame ###$reset" + echo -e "$Brown### Checking your OS ###$reset" if type pacman >/dev/null 2>&1;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 else install - echo -e "$Blue### install complete ###$reset" - echo -e "$Green### start build $reponame with archiso ###$reset" - build - makezip + echo -e "$Blue### Install complete ###$reset" + echo -e "$Green### Start build $reponame with archiso ###$reset" + build fi else - echo -e "$Red###os cant supported###$reset" + echo -e "$Red###OS can't supported###$reset" exit 1 fi } + install() { 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() { set -e mkarchiso -v iso/ } -makezip() { - cd out - 7z -v500m a "$(ls *.iso)".zip "$(ls *.iso)" - md5sum * > md5sums.txt -} - main diff --git a/iso/pacman.conf b/iso/pacman.conf index 4794755..8d4c0db 100644 --- a/iso/pacman.conf +++ b/iso/pacman.conf @@ -35,10 +35,13 @@ Architecture = auto CheckSpace #VerbosePkgLists #ParallelDownloads = 5 +DownloadUser = alpm + + # 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. -SigLevel = Required DatabaseOptional +SigLevel = Never LocalFileSigLevel = Optional #RemoteFileSigLevel = Required @@ -72,6 +75,10 @@ LocalFileSigLevel = Optional #[core-testing] #Include = /etc/pacman.d/mirrorlist +[ppr] +SigLevel = Optional TrustedOnly +Server = https://git.parchlinux.com/repo/ppr/-/raw/main/x86_64/ + [core] Include = /etc/pacman.d/mirrorlist @@ -87,16 +94,13 @@ Include = /etc/pacman.d/mirrorlist #[multilib-testing] #Include = /etc/pacman.d/mirrorlist -[multilib] -Include = /etc/pacman.d/mirrorlist - -[ppr] -SigLevel = Optional TrustedOnly -Server = https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/ +#[multilib] +#Include = /etc/pacman.d/mirrorlist [pcp] 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 # tips on creating your own repositories. diff --git a/iso/profiledef.sh b/iso/profiledef.sh index c040aa5..85712ad 100644 --- a/iso/profiledef.sh +++ b/iso/profiledef.sh @@ -1,24 +1,26 @@ #!/usr/bin/env bash # shellcheck disable=SC2034 -iso_name="Parchlinux Mate" -iso_label="PARCH_LINUX_MATE_$(date +%Y%m)" -iso_publisher="Parch Linux " -iso_application="Parch Linux Live/Rescue CD" -iso_version="$(date +%Y.%m.%d)" +iso_name="Parch Linux Mate" +iso_label="ParchLinux_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)" +iso_publisher="Parch Linux " +iso_application="Parch Linux Live/Rescue DVD" +iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" install_dir="arch" buildmodes=('iso') bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' - 'uefi-x64.systemd-boot.esp' - 'uefi-x64.systemd-boot.eltorito') + 'uefi-ia32.systemd-boot.esp' 'uefi-x64.systemd-boot.esp' + 'uefi-ia32.systemd-boot.eltorito' 'uefi-x64.systemd-boot.eltorito') arch="x86_64" pacman_conf="pacman.conf" airootfs_image_type="squashfs" 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=( ["/etc/shadow"]="0:0:400" ["/root"]="0:0:750" ["/root/.automated_script.sh"]="0:0:755" + ["/root/.gnupg"]="0:0:700" ["/usr/local/bin/choose-mirror"]="0:0:755" ["/usr/local/bin/Installation_guide"]="0:0:755" ["/usr/local/bin/livecd-sound"]="0:0:755" diff --git a/tools/upload_asset.py b/tools/upload_asset.py deleted file mode 100644 index 527e736..0000000 --- a/tools/upload_asset.py +++ /dev/null @@ -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.")