From 9049731906d10ba5c8ade9e7e0e628e9fe244616 Mon Sep 17 00:00:00 2001 From: Sohrab Behdani Date: Wed, 1 May 2024 09:58:34 +0330 Subject: [PATCH] added pacman config --- pacman-config/PKGBUILD | 21 ++++ pacman-config/README.md | 11 ++ .../parch-pacman/etc/pacman.conf.parch | 108 ++++++++++++++++++ .../etc/pacman.d/hooks/zx-grub-disk-type.hook | 10 ++ .../etc/pacman.d/hooks/zx-grub-disk-type.sh | 23 ++++ .../etc/pacman.d/hooks/zxe-grub-linux.hook | 12 ++ .../etc/pacman.d/hooks/zxe-grub-linux.sh | 2 + .../etc/pacman.d/mirrorlist.parch | 21 ++++ .../etc/pacman.d/pcp-mirrorlist.parch | 1 + .../etc/pacman.d/ppr-mirrorlist.parch | 1 + pacman-config/parch.install | 14 +++ 11 files changed, 224 insertions(+) create mode 100644 pacman-config/PKGBUILD create mode 100644 pacman-config/README.md create mode 100644 pacman-config/parch-pacman/etc/pacman.conf.parch create mode 100644 pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.hook create mode 100755 pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.sh create mode 100644 pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.hook create mode 100755 pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.sh create mode 100644 pacman-config/parch-pacman/etc/pacman.d/mirrorlist.parch create mode 100644 pacman-config/parch-pacman/etc/pacman.d/pcp-mirrorlist.parch create mode 100644 pacman-config/parch-pacman/etc/pacman.d/ppr-mirrorlist.parch create mode 100644 pacman-config/parch.install diff --git a/pacman-config/PKGBUILD b/pacman-config/PKGBUILD new file mode 100644 index 0000000..bf0a9b0 --- /dev/null +++ b/pacman-config/PKGBUILD @@ -0,0 +1,21 @@ +# Maintainer: Parchlinux +pkgname=parch-pacman +destname="/" +pkgver=27 +pkgrel=0 +pkgdesc="parchlinux custom pacman config" +arch=('any') +url="https://github.com/parchlinux" +license=('GPL3') +makedepends=() +install="parch.install" +depends=() +conflicts=() +provides=("${pkgname}") +options=(!strip !emptydirs) +source=("parch-pacman.zip") +sha256sums=('SKIP') +package() { + install -dm755 ${pkgdir}${destname} + cp -r ${srcdir}/${pkgname}${destname}/* ${pkgdir}${destname} +} diff --git a/pacman-config/README.md b/pacman-config/README.md new file mode 100644 index 0000000..72a023e --- /dev/null +++ b/pacman-config/README.md @@ -0,0 +1,11 @@ +# How to remake + +```bash + +zip -r parch-pacman.zip parch-pacman + +makepkg -sc + +``` + +- Submit your changes as PullRequest diff --git a/pacman-config/parch-pacman/etc/pacman.conf.parch b/pacman-config/parch-pacman/etc/pacman.conf.parch new file mode 100644 index 0000000..7c509a2 --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.conf.parch @@ -0,0 +1,108 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -L -C - -f -o %o %u +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +Architecture = auto + +# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +Color +#NoProgressBar +CheckSpace +VerbosePkgLists +ParallelDownloads = 5 +ILoveCandy + +# 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 +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +#[core-testing] +#Include = /etc/pacman.d/mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +#[extra-testing] +#Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +# If you want to run 32 bit applications on your x86_64 system, +# enable the multilib repositories as required here. + +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist + +[multilib] +Include = /etc/pacman.d/mirrorlist + +[ppr] +SigLevel = Optional TrustAll +Include = /etc/pacman.d/ppr-mirrorlist + +[pcp] +SigLevel = Optional TrustAll +Include = /etc/pacman.d/pcp-mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs + + diff --git a/pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.hook b/pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.hook new file mode 100644 index 0000000..030abbb --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.hook @@ -0,0 +1,10 @@ +[Trigger] +Operation = Upgrade +Operation = Install +Type = Package +Target = grub +[Action] +Description = Reinstall GRUB +When = PostTransaction +Exec = /bin/bash -c '/etc/pacman.d/hooks/zx-grub-disk-type.sh' + diff --git a/pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.sh b/pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.sh new file mode 100755 index 0000000..d133d8a --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/hooks/zx-grub-disk-type.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Check if the system is running in UEFI mode +if [[ -d "/sys/firmware/efi" ]]; then + # UEFI mode detected + echo "UEFI system detected. Reinstalling GRUB for UEFI..." + grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Parch +else + # Legacy (BIOS) mode detected + echo "Legacy (BIOS) system detected. Reinstalling GRUB for BIOS..." + + # Find the primary disk for MBR installations + primary_disk=$(lsblk -o NAME,SIZE,MOUNTPOINT -nl | awk '$3=="/" {print $1}' | sed 's/[0-9]//g') + + if [[ -n "$primary_disk" ]]; then + grub-install --target=i386-pc --recheck "/dev/$primary_disk" + else + echo "Error: Unable to determine primary disk. Check your configuration." + exit 1 + fi +fi + +grub-mkconfig -o /boot/grub/grub.cfg diff --git a/pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.hook b/pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.hook new file mode 100644 index 0000000..8bb5c74 --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.hook @@ -0,0 +1,12 @@ +[Trigger] +Operation = Upgrade +Operation = Install +Type = Package +Target = linux +Target = linux-* +Target = systemd +Target = grub +[Action] +Description = Generate GRUB configuration +When = PostTransaction +Exec = /bin/bash -c '/etc/pacman.d/hooks/zxe-grub-linux.sh' diff --git a/pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.sh b/pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.sh new file mode 100755 index 0000000..322d261 --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/hooks/zxe-grub-linux.sh @@ -0,0 +1,2 @@ +# Generate GRUB configuration +grub-mkconfig -o /boot/grub/grub.cfg diff --git a/pacman-config/parch-pacman/etc/pacman.d/mirrorlist.parch b/pacman-config/parch-pacman/etc/pacman.d/mirrorlist.parch new file mode 100644 index 0000000..13883f0 --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/mirrorlist.parch @@ -0,0 +1,21 @@ +################################################################################ +################# Arch Linux mirrorlist generated by Reflector ################# +################################################################################ + +# With: reflector --verbose --protocol https --age 2 --sort rate --number 10 +# When: 2024-04-12 17:50:12 UTC +# From: https://archlinux.org/mirrors/status/json/ +# Retrieved: 2024-04-12 17:50:12 UTC +# Last Check: 2024-04-12 17:16:00 UTC + +Server = https://mirror.aarnet.edu.au/pub/archlinux/$repo/os/$arch +Server = https://mirror.puzzle.ch/archlinux/$repo/os/$arch +Server = https://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/$arch +Server = https://mirror.archlinux.no/$repo/os/$arch +Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch +Server = https://ftp.rnl.tecnico.ulisboa.pt/pub/archlinux/$repo/os/$arch +Server = https://mirrors.dotsrc.org/archlinux/$repo/os/$arch +Server = https://archlinux.cs.nycu.edu.tw/$repo/os/$arch +Server = https://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch +Server = https://mirror.ams1.nl.leaseweb.net/archlinux/$repo/os/$arch + diff --git a/pacman-config/parch-pacman/etc/pacman.d/pcp-mirrorlist.parch b/pacman-config/parch-pacman/etc/pacman.d/pcp-mirrorlist.parch new file mode 100644 index 0000000..d16f4bd --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/pcp-mirrorlist.parch @@ -0,0 +1 @@ +Server = https://raw.githubusercontent.com/parchlinux/pcp/main/x86_64/ diff --git a/pacman-config/parch-pacman/etc/pacman.d/ppr-mirrorlist.parch b/pacman-config/parch-pacman/etc/pacman.d/ppr-mirrorlist.parch new file mode 100644 index 0000000..4892108 --- /dev/null +++ b/pacman-config/parch-pacman/etc/pacman.d/ppr-mirrorlist.parch @@ -0,0 +1 @@ +Server = https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/ diff --git a/pacman-config/parch.install b/pacman-config/parch.install new file mode 100644 index 0000000..4a2ff78 --- /dev/null +++ b/pacman-config/parch.install @@ -0,0 +1,14 @@ +post_install() { + + cp etc/pacman.conf.parch etc/pacman.conf + cp etc/pacman.d/mirrorlist.parch etc/pacman.d/mirrorlist + cp etc/pacman.d/pcp-mirrorlist.parch etc/pacman.d/pcp-mirrorlist + cp etc/pacman.d/ppr-mirrorlist.parch etc/pacman.d/ppr-mirrorlist + cp etc/pacman.d/ptr-mirrorlist.parch etc/pacman.d/ptr-mirrorlist + rm /etc/pacman.d/*.parch + rm /etc/pacman.conf.parch +} + +post_upgrade() { + post_install +}