Compare commits

..

3 commits
stable ... main

Author SHA1 Message Date
b08d876b53 un-sudo tee it 2024-10-15 10:10:54 -05:00
askiiart
73d9f01926
add /opt 2024-10-09 09:39:45 -05:00
askiiart
ed115df979
initial commit - switches to rate-mirrors, some minor updates, etc 2024-10-01 12:24:46 -05:00
2 changed files with 16 additions and 16 deletions

26
akshara
View file

@ -19,15 +19,11 @@
import os
import sys
import time
import yaml
import shutil
import filecmp
import argparse
import requests
import platform
import fasteners
from threading import Event
import subprocess
__version = '1.0.0'
@ -137,6 +133,10 @@ def update_system():
blend_release = yaml.load(
blend_release_file, Loader=yaml.FullLoader)
# TODO: Add check that all packages actually exist
info('downloading Arch tarball...')
# TODO: currently it errors if it doesn't have arch-repo anyways, so this doesn't need any extra checking, maybe add a check for that later though
@ -250,17 +250,8 @@ def update_system():
exec_chroot('pacman-key', '--init')
exec_chroot('pacman-key', '--populate')
counter = 0
while True:
return_val = exec_chroot('pacman', '-Sy', '--ask=4', 'reflector')
counter += 1
if counter > 30:
error('failed to download packages')
exit(50)
if return_val == 0:
break
exec_chroot('reflector', '--latest', '5', '--protocol', 'https', '--sort', 'rate', '--save', '/etc/pacman.d/mirrorlist')
exec_chroot('sh', '-c', 'mkdir /tmp/rate-mirrors/; cd /tmp/rate-mirrors/; curl -LO $(curl -s https://api.github.com/repos/westandskif/rate-mirrors/releases/latest | grep "browser_download_url.*rate-mirrors-v.*-x86_64-unknown-linux-musl.tar.gz" | cut -d : -f 2,3 | tr -d \\")')
exec_chroot('bash', '-c', 'cd /tmp/rate-mirrors/; tar -xzf rate-mirrors*; cd $(find /tmp/rate-mirrors/ -mindepth 1 -maxdepth 1 -type d); ./rate_mirrors --disable-comments-in-file --entry-country=US --protocol=https arch --max-delay 7200 > /etc/pacman.d/mirrorlist')
#exec_chroot('sed', 's/#//g', '-i', '/etc/pacman.d/mirrorlist')
#exec_chroot('bash', '-c', 'grep "^Server =" /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist.tmp; mv /etc/pacman.d/mirrorlist.tmp /etc/pacman.d/mirrorlist')
@ -300,6 +291,7 @@ Server = {package_repo["repo-url"]}
counter = 0
while True:
print('running packages again')
return_val = exec_chroot('pacman', '-S', '--ask=4', *packages)
counter += 1
if counter > 30:
@ -311,6 +303,7 @@ Server = {package_repo["repo-url"]}
counter = 0
if aur_packages != []:
while True:
print('running aur_packages again')
exec_chroot('useradd', '-m', '-G', 'wheel', '-s', '/bin/bash', 'aur')
exec_chroot('bash', '-c', 'echo "aur ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aur')
return_val = exec_chroot(
@ -416,7 +409,8 @@ Server = {package_repo["repo-url"]}
exec('cp', '-ax', '/.new_rootfs/var/lib/pacman', '/.new.var.lib/pacman')
exec('mv', '.new_rootfs', '.update_rootfs')
exec('cp', '-ax', '/.update_rootfs/etc', '/.update_rootfs/usr/etc')
# don't move /etc/shells to /usr/etc
exec('bash', '-c', 'shopt -s extglob; cd /.update_rootfs/etc; cp -ax !(shells) /.update_rootfs/usr/etc; cd -')
new_boot_files = []

View file

@ -23,6 +23,12 @@ run_latehook() {
mv /new_root/.new.etc /new_root/etc
fi
# Same for /opt
if [[ -d /new_root/.update_rootfs/opt ]]; then
mv /new_root/opt /new_root/.old.opt
mv /new_root/.update_rootfs/opt /new_root/opt
fi
# Same for /var.
if [[ -d /new_root/.new.var.lib ]]; then
mv /new_root/var/lib /new_root/.old.var.lib