summaryrefslogtreecommitdiff
path: root/sysresccd
diff options
context:
space:
mode:
Diffstat (limited to 'sysresccd')
-rw-r--r--sysresccd/grub.conf12
-rwxr-xr-xsysresccd/relchk.py52
2 files changed, 64 insertions, 0 deletions
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<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)