Closed syn990 closed 9 months ago
I lost and wrote this script twice now. I will make another again...
This technically works now. Check out the source below.
It's been a while and as nice that it works I can barley understand because of the nested variables so I will need to really get that documented and resolved.
It's a collection of functions, colourful behaviour and will copy all the packages from existing install, and dump them into the "repo" which is a local folder.
`#!/bin/bash
init_colours() { RED='\033[1;31m' GREEN='\033[0;32m' BLUE='\033[0;34m' NC='\033[0m' }
check_success() { if [ $? -ne 0 ]; then printf "${RED}$1${NC}\n" exit 1 fi }
init_variables() { username="syntax990" github_project_name="SYN-OS" local_repo_name="SYN-OS-REPO" profile_name="SYN-OS-V4"
github_project_path="/home/$username/$github_project_name"
local_repo_path="/home/$username/$local_repo_name"
releng_custom_path="/home/$username/$github_project_name/$profile_name"
cache_path="/var/cache/pacman/pkg"
}
display_info() { printf "${GREEN}Equipping local pacman repository to the Archiso profile...\n\n${NC}" sleep 0.5 printf "Username: ${BLUE}$username${NC}\n" sleep 0.5 printf "GitHub Project Name: ${BLUE}$github_project_name${NC}\n" sleep 0.5 printf "Local Repository Path: ${BLUE}$local_repo_path${NC}\n" sleep 0.5 printf "Cache path: ${BLUE}$cache_path${NC}\n" sleep 0.5 printf "Releng custom path: ${BLUE}$releng_custom_path${NC}\n\n${NC}" sleep 0.5 }
clean_directories() { printf "${GREEN}Cleaning up existing directories...\n${NC}" sleep 0.5 rm -Rv $local_repo_path rm -Rv $releng_custom_path/airootfs/root/$local_repo_name }
create_repository() { printf "${GREEN}Creating a new directory for the local repository...\n${NC}" sleep 0.5 mkdir -p $local_repo_path check_success "Failed to create directory $local_repo_path" }
copy_packages() { printf "${GREEN}Copying all packages from the local cache to the local repository...\n${NC}" sleep 0.5 cp $cache_path/* $local_repo_path check_success "Failed to copy packages from $cache_path to $local_repo_path" }
generate_database() { printf "${GREEN}Generating a database for the local repository...\n${NC}" sleep 0.5 repo-add $local_repo_path/$local_repo_name.db.tar.gz $local_repo_path/*.pkg.tar.zst check_success "Failed to generate a database for the local repository" }
copy_to_releng() { printf "${GREEN}Copying the local repository to the releng profile in Archiso...\n${NC}" sleep 0.5
# Create target directory if it doesn't exist
mkdir -p $releng_custom_path/airootfs/root
cp -rv $local_repo_path $releng_custom_path/airootfs/root
check_success "Failed to copy the local repository to the releng profile in Archiso"
}
main() { init_colours init_variables display_info clean_directories create_repository copy_packages generate_database copy_to_releng printf "${GREEN}The script has completed its operations.\n${NC}" }
main`
I've removed it since using SYN-BUILDER.zsh and REBUILD_ISO.sh etc attempted to really automate useless things from mkarchiso.
The repo also killed a system and borked it's updates, with packages in the repos not getting updated due to being "up-to-date" in the SYN-REPO found in pacman.conf.
Over time the system would gradually stop updating and become a buggy mess.
There is a more robust solution to pacstrap and local downloaded packages than simply cloning a live test environment's packages.
Problem: Building Arch Linux systems with internet access can be slow and consume a lot of data, especially in areas with limited network.
Solution: Installing local packages can make building faster and more efficient.
Caution: Local repositories may contain outdated packages and compromise system reliability, so they should only be used in special cases.
Recommendation: For a secure and reliable system, it's best to use the official Arch Linux repository, unless there is a specific need for a local repository.