This commit is contained in:
brent s 2019-10-31 08:26:22 -04:00
parent 72298d7a4c
commit 701949b8f7
3 changed files with 78 additions and 0 deletions

14
arch/grub.conf Normal file
View File

@ -0,0 +1,14 @@
#!/bin/sh
exec tail -n +3 $0
# Copy this file to /etc/grub.d/40_custom_arch with mode 0755 and run grub-mkconfig -o /boot/grub/grub.cfg

# Arch ISO
# https://wiki.archlinux.org/index.php/Multiboot_USB_drive#Arch_Linux_monthly_release
menuentry 'Arch Install ISO' {
set isofile='/iso/arch.iso'
probe -u $root --set=imgdevuuid
set imgdevpath="/dev/disk/by-uuid/$imgdevuuid"
loopback loop $isofile
linux (loop)/arch/boot/x86_64/vmlinuz img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
initrd (loop)/arch/boot/x86_64/archiso.img
}

12
sysresccd/grub.conf Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
exec tail -n +3 $0
# Copy this file to /etc/grub.d/40_custom_sysresccd with mode 0755 and run grub-mkconfig -o /boot/grub/grub.cfg

menuentry 'System Rescue CD' {
set isofile='/iso/sysresccd.iso'
probe -u $root --set=imgdevuuid
set imgdevpath="/dev/disk/by-uuid/$imgdevuuid"
loopback loop $isofile
linux (loop)/sysresccd/boot/x86_64/vmlinuz archisobasedir=sysresccd img_dev=$imgdevpath img_loop=$isofile earlymodules=loop
initrd (loop)/sysresccd/boot/intel_ucode.img (loop)/sysresccd/boot/amd_ucode.img (loop)/sysresccd/boot/x86_64/sysresccd.img
}

52
sysresccd/relchk.py Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python3

# TODO: add config file support

import os
import re
import shutil
import subprocess
##
import requests
from lxml import etree

dest_dir = '/boot/iso'
dest_file = 'sysresccd.iso'
ver_file = '.sysresccd.info'
feed_url = 'https://osdn.net/projects/systemrescuecd/storage/!rss'
dl_base = ('https://osdn.net/frs/'
'redir.php?m=constant&f='
'/storage/g/s/sy/systemrescuecd/releases/{version}/systemrescuecd-{version}.iso')
old_version = None
new_version = None
grub_cfg = '/etc/grub.d/40_custom_sysresccd'


def downloadISO(url, version):
dest = os.path.join(dest_dir, dest_file)
destver = os.path.join(dest_dir, ver_file)
with requests.get(url, stream = True) as url:
with open(dest, 'wb') as fh:
shutil.copyfileobj(url.raw, fh)
with open(destver, 'w') as fh:
fh.write(version.strip())
return()


if os.path.isfile(os.path.join(dest_dir, ver_file)):
with open(os.path.join(dest_dir, ver_file), 'r') as f:
old_version = f.read().strip()
r = requests.get(feed_url)
if not r.ok:
raise RuntimeError('Could not fetch feed from {0}'.format(feed_url))
feed = etree.fromstring(r.content)
latest = feed.xpath('//item')[0]
raw_version = os.path.basename(latest.find('title').text.strip())
new_version = re.sub(r'^systemrescuecd-(x86-)?(?P<version>[0-9.]+).iso',
r'\g<version>',
raw_version)
dl_url = dl_base.format(version = new_version)
if old_version and old_version != new_version:
downloadISO(dl_url, new_version)
elif not old_version:
downloadISO(dl_url, new_version)