diff --git a/arch/grub.conf b/arch/grub.conf new file mode 100644 index 0000000..abd0e0b --- /dev/null +++ b/arch/grub.conf @@ -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 +} diff --git a/sysresccd/grub.conf b/sysresccd/grub.conf new file mode 100644 index 0000000..e24b3f0 --- /dev/null +++ b/sysresccd/grub.conf @@ -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 +} diff --git a/sysresccd/relchk.py b/sysresccd/relchk.py new file mode 100755 index 0000000..a2b5b6f --- /dev/null +++ b/sysresccd/relchk.py @@ -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[0-9.]+).iso', + r'\g', + 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)