Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fepitre committed Dec 17, 2018
0 parents commit 2d38bdf
Show file tree
Hide file tree
Showing 59 changed files with 8,437 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkgs/
116 changes: 116 additions & 0 deletions 0001-anaconda-add-Qubes-installclass.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
From aef23d6edb86739638cdaf08e7892683681392b1 Mon Sep 17 00:00:00 2001
From: Tomasz Sterna <tomek@xiaoka.com>
Date: Fri, 19 Oct 2018 08:02:11 +0200
Subject: [PATCH] anaconda: add Qubes installclass
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Frédéric Pierret <frederic.epitre@orange.fr>
---
pyanaconda/installclasses/qubes.py | 93 ++++++++++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)
create mode 100644 pyanaconda/installclasses/qubes.py

diff --git a/pyanaconda/installclasses/qubes.py b/pyanaconda/installclasses/qubes.py
new file mode 100644
index 000000000..e98912b63
--- /dev/null
+++ b/pyanaconda/installclasses/qubes.py
@@ -0,0 +1,93 @@
+#
+# qubes.py
+#
+# Copyright (C) 2011 Invisible Things Lab All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+from pyanaconda.installclass import BaseInstallClass
+from pyanaconda.constants import *
+from pyanaconda.product import *
+from pyanaconda import network
+from pyanaconda.i18n import N_
+import os, types
+import blivet.platform
+
+from blivet.size import Size
+from blivet.platform import platform
+from decimal import Decimal
+
+class InstallClass(BaseInstallClass):
+ # name has underscore used for mnemonics, strip if you dont need it
+ id = "qubes"
+ name = N_("Qubes")
+ _description = N_("The default installation of %s is a minimal install. "
+ "You can optionally select a different set of software "
+ "now.")
+ _descriptionFields = (productName,)
+ sortPriority = 20000
+ hidden = 0
+ efi_dir = 'qubes'
+ _l10n_domain = "anaconda"
+ installUpdates = False
+
+ bootloaderTimeoutDefault = 5
+
+ tasks = [(N_("Minimal"), ["base", "base-x", "kde-desktop-qubes", "qubes" ]) ]
+
+ help_placeholder = "QubesPlaceholder.html"
+ help_placeholder_with_links = "QubesPlaceholderWithLinks.html"
+
+ def getPackagePaths(self, uri):
+ if not type(uri) == types.ListType:
+ uri = [uri,]
+
+ return {'Installation Repo': uri}
+
+ def configure(self, anaconda):
+ BaseInstallClass.configure(self, anaconda)
+ self.setDefaultPartitioning(anaconda.storage)
+
+ def setDefaultPartitioning(self, storage):
+ BaseInstallClass.setDefaultPartitioning(self,
+ storage)
+ for autoreq in list(storage.autopart_requests):
+ if autoreq.mountpoint == "/":
+ autoreq.max_size=None
+ autoreq.required_space=Size("10GiB")
+ if autoreq.mountpoint == "/home":
+ storage.autopart_requests.remove(autoreq)
+ if autoreq.mountpoint == "/boot/efi":
+ autoreq.max_size=Size("500MiB")
+ if autoreq.mountpoint == "/boot" and \
+ isinstance(platform, blivet.platform.EFI):
+ # xen.efi don't need /boot
+ storage.autopart_requests.remove(autoreq)
+
+ def productMatches(self, oldprod):
+ if oldprod is None:
+ return False
+
+ if oldprod.startswith(productName):
+ return True
+
+ return False
+
+ def versionMatches(self, oldver):
+ return True
+
+ def __init__(self):
+ BaseInstallClass.__init__(self)
--
2.14.4

89 changes: 89 additions & 0 deletions 0002-anaconda-add-Qubes-post-scripts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
From 0cb13168feb3dfd4b9510c89ed3bc005a23795ca Mon Sep 17 00:00:00 2001
From: Tomasz Sterna <tomek@xiaoka.com>
Date: Fri, 19 Oct 2018 08:02:11 +0200
Subject: [PATCH] anaconda: add Qubes post-scripts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Frédéric Pierret <frederic.epitre@orange.fr>
---
data/post-scripts/40-qubes-alt-kernels.ks | 20 ++++++++++++++++++++
data/post-scripts/50-qubes.ks | 5 +++++
data/post-scripts/60-systemd-preset.ks | 13 +++++++++++++
data/post-scripts/Makefile.am | 2 +-
4 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 data/post-scripts/40-qubes-alt-kernels.ks
create mode 100644 data/post-scripts/50-qubes.ks
create mode 100644 data/post-scripts/60-systemd-preset.ks

diff --git a/data/post-scripts/40-qubes-alt-kernels.ks b/data/post-scripts/40-qubes-alt-kernels.ks
new file mode 100644
index 000000000..4909a99ee
--- /dev/null
+++ b/data/post-scripts/40-qubes-alt-kernels.ks
@@ -0,0 +1,20 @@
+%post --nochroot
+
+for pkg in /run/install/repo/extrakernels/*.rpm; do
+ name=`basename $pkg .rpm`
+ rpm --root=$ANA_INSTALL_PATH -q $name > /dev/null || rpm --root=$ANA_INSTALL_PATH -i --oldpackage $pkg
+done
+
+# Set grub default to the current kernel if running not the latest one
+latest=`basename /run/install/repo/Packages/k/kernel-[0-9]*.rpm .rpm|cut -d- -f2-`
+if [ "$latest" != "`uname -r`" ]; then
+ rootdev=`grep " $ANA_INSTALL_PATH " /proc/mounts | cut -f 1 -d ' '`
+ sysid=`blkid -o value -s UUID $rootdev`
+ xenver=`dmesg | grep 'Xen version:' | sed -e 's/.*version: \([0-9.]\+\).*/\1/'`
+ grubid="gnulinux-advanced-$sysid"
+ grubid="$grubid>xen-hypervisor-$xenver-$sysid"
+ grubid="$grubid>xen-gnulinux-`uname -r`-advanced-$sysid"
+ grub2-set-default --boot-directory=$ANA_INSTALL_PATH/boot "$grubid"
+fi
+
+%end
diff --git a/data/post-scripts/50-qubes.ks b/data/post-scripts/50-qubes.ks
new file mode 100644
index 000000000..1b9238b40
--- /dev/null
+++ b/data/post-scripts/50-qubes.ks
@@ -0,0 +1,5 @@
+%post
+
+rpm --import /etc/pki/rpm-gpg/*
+
+%end
diff --git a/data/post-scripts/60-systemd-preset.ks b/data/post-scripts/60-systemd-preset.ks
new file mode 100644
index 000000000..9e6cb3f3a
--- /dev/null
+++ b/data/post-scripts/60-systemd-preset.ks
@@ -0,0 +1,13 @@
+%post
+
+# preset all services, to not worry about package installation order (preset
+# files vs services)
+systemctl preset-all
+
+systemctl enable initial-setup.service
+
+# systemctl preset-all disables default target
+# (https://bugzilla.redhat.com/1316387), re-enable it manually
+systemctl set-default graphical.target
+
+%end
diff --git a/data/post-scripts/Makefile.am b/data/post-scripts/Makefile.am
index 7d78d4bc3..ad2f6497d 100644
--- a/data/post-scripts/Makefile.am
+++ b/data/post-scripts/Makefile.am
@@ -16,5 +16,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

postscriptsdir = $(datadir)/$(PACKAGE_NAME)/post-scripts
-dist_postscripts_DATA = 80-setfilecons.ks 90-copy-screenshots.ks 99-copy-logs.ks
+dist_postscripts_DATA = 40-qubes-alt-kernels.ks 50-qubes.ks 60-systemd-preset.ks 80-setfilecons.ks 90-copy-screenshots.ks 99-copy-logs.ks
MAINTAINERCLEANFILES = Makefile.in
--
2.14.4

154 changes: 154 additions & 0 deletions 0003-anaconda-remove-other-installclasses.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
From 5ccbe4b9f6265ac4e07f0539da39db809fc8020a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
<frederic.epitre@orange.fr>
Date: Fri, 19 Oct 2018 08:02:11 +0200
Subject: [PATCH] anaconda: remove other installclasses
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Frédéric Pierret <frederic.epitre@orange.fr>
---
pyanaconda/installclasses/fedora.py | 58 ---------------------------------
pyanaconda/installclasses/rhel.py | 64 -------------------------------------
2 files changed, 122 deletions(-)
delete mode 100644 pyanaconda/installclasses/fedora.py
delete mode 100644 pyanaconda/installclasses/rhel.py

diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
deleted file mode 100644
index c9ced65fd..000000000
--- a/pyanaconda/installclasses/fedora.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# fedora.py
-#
-# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-from pyanaconda.installclass import BaseInstallClass
-from pyanaconda.product import productName
-from pyanaconda import network
-from pyanaconda import nm
-
-class FedoraBaseInstallClass(BaseInstallClass):
- name = "Fedora"
- sortPriority = 10000
- if productName.startswith("Red Hat "): # pylint: disable=no-member
- hidden = True
-
- _l10n_domain = "anaconda"
-
- efi_dir = "fedora"
-
- help_placeholder = "FedoraPlaceholder.html"
- help_placeholder_with_links = "FedoraPlaceholderWithLinks.html"
-
- def configure(self, anaconda):
- BaseInstallClass.configure(self, anaconda)
- BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
-
- def setNetworkOnbootDefault(self, ksdata):
- if any(nd.onboot for nd in ksdata.network.network if nd.device):
- return
- # choose first wired device having link
- for dev in nm.nm_devices():
- if nm.nm_device_type_is_wifi(dev):
- continue
- try:
- link_up = nm.nm_device_carrier(dev)
- except (nm.UnknownDeviceError, nm.PropertyNotFoundError):
- continue
- if link_up:
- network.update_onboot_value(dev, True, ksdata=ksdata)
- break
-
- def __init__(self):
- BaseInstallClass.__init__(self)
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
deleted file mode 100644
index 7e907e4bd..000000000
--- a/pyanaconda/installclasses/rhel.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# rhel.py
-#
-# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-from pyanaconda.installclass import BaseInstallClass
-from pyanaconda.product import productName
-from pyanaconda import network
-from pyanaconda import nm
-
-class RHELBaseInstallClass(BaseInstallClass):
- name = "Red Hat Enterprise Linux"
- sortPriority = 10000
- if not productName.startswith("Red Hat "): # pylint: disable=no-member
- hidden = True
- defaultFS = "xfs"
-
- bootloaderTimeoutDefault = 5
-
- ignoredPackages = ["ntfsprogs"]
-
- installUpdates = False
-
- _l10n_domain = "comps"
-
- efi_dir = "redhat"
-
- help_placeholder = "RHEL7Placeholder.html"
- help_placeholder_with_links = "RHEL7PlaceholderWithLinks.html"
-
- def configure(self, anaconda):
- BaseInstallClass.configure(self, anaconda)
- BaseInstallClass.setDefaultPartitioning(self, anaconda.storage)
-
- def setNetworkOnbootDefault(self, ksdata):
- if any(nd.onboot for nd in ksdata.network.network if nd.device):
- return
- # choose the device used during installation
- # (ie for majority of cases the one having the default route)
- dev = network.default_route_device() \
- or network.default_route_device(family="inet6")
- if not dev:
- return
- # ignore wireless (its ifcfgs would need to be handled differently)
- if nm.nm_device_type_is_wifi(dev):
- return
- network.update_onboot_value(dev, True, ksdata=ksdata)
-
- def __init__(self):
- BaseInstallClass.__init__(self)
--
2.14.4

Loading

0 comments on commit 2d38bdf

Please sign in to comment.