...
 
Commits (31)
#!/bin/bash
set e
#set e # "if...else" blokovi su beskorisni ako je postavljeno! NE KORISTITI!!!
# sve što je potrebno za instalaciju refind već imamo u triosefi.img
# dakle, prikopčamo triosefi.img pod /mnt, prekopiramo gde šta treba u target
......@@ -18,6 +18,41 @@ cd / && umount /mnt
# instalacija efibootmgr, za slučaj da nema mreže, može da se odradi i kroz support folder u iso
# zajedno sa grub-efi paketima ?
apt update && apt install -y efibootmgr
efibootmgr -c -l \\EFI\\boot\\grubx64.efi -L rEFInd
exit 0
\ No newline at end of file
while getopts "vd:p:" opt; do
case $opt in
v) VERBOSE="-v"
;;
d) DISK="$OPTARG"
;;
p) PARTITION="$OPTARG"
;;
*) echo "Unknown parameter: $OPTARG"
;;
esac
done
if [ ! -z "$VERBOSE" ]; then
V="True"
else
V="False"
fi
if [ -z "$DISK" ] && [ -z "$PARTITION" ] && [ ! -z "$VERBOSE" ]; then
echo "--! efibootmgr called with no parameters ( verbose output on ), defaulting to /dev/sda !--"
efibootmgr -c -l \\EFI\\boot\\grubx64.efi -L rEFInd "$VERBOSE"
elif [ -z "$DISK" ] && [ -z "$PARTITION" ] && [ -z "$VERBOSE" ]; then
echo "--! efibootmgr called with no parameters, defaulting to /dev/sda !--"
efibootmgr -c -l \\EFI\\boot\\grubx64.efi -L rEFInd "$VERBOSE"
elif [ ! -z "$DISK" ] && [ -z "$PARTITION" ]; then
echo "--! efibootmgr called with: -d $DISK -p $PARTITION (VERBOSE=$V) !--"
efibootmgr -d "$DISK" -c -l \\EFI\\boot\\grubx64.efi -L rEFInd "$VERBOSE"
elif [ -z "$DISK" ] && [ ! -z "$PARTITION" ]; then
echo "--! efibootmgr called with: -d $DISK -p $PARTITION (VERBOSE=$V) !--"
efibootmgr -p "$PARTITION" -c -l \\EFI\\boot\\grubx64.efi -L rEFInd "$VERBOSE"
elif [ ! -z "$DISK" ] && [ ! -z "$PARTITION" ]; then
echo "--! efibootmgr called with: -d $DISK -p $PARTITION (VERBOSE=$V) !--"
efibootmgr -d "$DISK" -p "$PARTITION" -c -l \\EFI\\boot\\grubx64.efi -L rEFInd "$VERBOSE"
fi
exit 0
......@@ -33,6 +33,7 @@ bootloader = grub
# https://github.com/semplice/meta/commit/e5399d0523761eec3505da24add52cebc44f5452
# for more details.
custom_init = /lib/systemd/systemd
grub_cmdline_linux_default = quiet
[module:supportrepo]
path = file:///lib/live/mount/medium/support
......
......@@ -24,6 +24,7 @@ autoremove = True
[module:bootloader]
bootloader = grub
grub_cmdline_linux_default = quiet
[module:supportrepo]
path = file:///lib/live/mount/medium/support
......
......@@ -10,6 +10,8 @@ import subprocess
import locale, t9n.library
import os
locale.setlocale(locale.LC_ALL, '')
locale.bindtextdomain("linstaller", "/usr/share/locale")
_ = t9n.library.translation_init("linstaller")
......@@ -95,6 +97,12 @@ class Window:
self.dialogclose.connect("clicked", self.hide_dialog)
self.errorclose.connect("clicked", self.hide_error)
if os.path.exists("/etc/semplice-live-mode"):
# Semplice, we can cheer up! :)
self.crashwindow.set_markup(
_("<big><b>Drunk people should not write software.</b></big>")
)
self.crashwindow.show()
win = Window()
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkMessageDialog" id="crash">
<property name="width_request">400</property>
<property name="can_focus">False</property>
......@@ -13,17 +14,16 @@
<property name="type_hint">dialog</property>
<property name="urgency_hint">True</property>
<property name="message_type">other</property>
<property name="text" translatable="yes">&lt;big&gt;&lt;b&gt;Some people should not write software.&lt;/b&gt;&lt;/big&gt;</property>
<property name="text" translatable="yes">&lt;big&gt;&lt;b&gt;An error occurred.&lt;/b&gt;&lt;/big&gt;</property>
<property name="use_markup">True</property>
<property name="secondary_text" translatable="yes">Unfortunately, this is our case.
We are sorry to tell you that the installer for some reason crashed.
<property name="secondary_text" translatable="yes">We are sorry to tell you that the installer for some reason crashed.
There is a log file that you may want to read to see what is wrong. Its path is:
&lt;b&gt;/var/log/linstaller/linstaller_latest.log&lt;/b&gt;
Use the "&lt;i&gt;Pastebin it!&lt;/i&gt;" button to post it to a public pastebin. A working Internet connection is required.
You can then use the OSS forum at the following address to get help:
You can then use the FOSS forum at the following address to get help:
&lt;u&gt;http://www.foss.rs/index.php/forum/192-trios-srpska-gnulinux-distribucija/&lt;/u&gt; </property>
<property name="secondary_use_markup">True</property>
......@@ -43,7 +43,6 @@ You can then use the OSS forum at the following address to get help:
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -58,7 +57,6 @@ You can then use the OSS forum at the following address to get help:
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -104,7 +102,6 @@ You can then use the OSS forum at the following address to get help:
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
......@@ -151,7 +148,6 @@ You can then use the OSS forum at the following address to get help:
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
......
linstaller (7.0.7~fd2) stable; urgency=medium
* Fix failure to set new root password if there is allready one set for
the live mode.
-- Filip Danilovic <[email protected]> Mon, 27 Mar 2017 23:48:37 +0200
linstaller (7.0.7~fd1) stable; urgency=medium
* debian/control:
- Depend on os-prober, fixes distro detection for auto partitioning.
- Format properly.
- Point Vcs-* and Homepage urls to GitLab.
- Set myself as a maintainer.
-- Filip Danilovic <[email protected]> Mon, 27 Mar 2017 18:00:39 +0200
linstaller (7.0.7-1~ummagumma0) unstable; urgency=medium
* [userhost] Get user-defaults-groups from preseed
* [userhost] Check additional user groups from the preseed.
* [packaging] Remove bricks from the -base module set.
* [userhost] Get seeds from self.moduleclass.settings
* [linstaller] More distribution-agnostic .desktop file
* [finish] Create missing snakeoil SSL certs
* [crash] Use a more serious primary text when not on Semplice
* [bootloader] Expose GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX to preseeds
* [config] semplice-base: re-introduce the 'quiet' cmdline_linux_default that was implied before b867d7a
* [userhost] Properly check user_additional_groups
-- Eugenio Paolantonio (g7) <[email protected]> Tue, 02 Feb 2016 17:59:55 +0100
linstaller (7.0.6~mia10) stable; urgency=medium
* Stable release with initial NVMe support.
* More details in the "dev" releases bellow.
-- Filip Danilovic <[email protected]> Sat, 11 Mar 2017 03:53:35 +0100
linstaller (7.0.6~mia9+dev) testing; urgency=medium
[Miloš Pavlović]
* Properly detect and show NVMe ssd´s and mmcblk devices.
-- Filip Danilovic <[email protected]> Mon, 05 Dec 2016 21:28:52 +0100
linstaller (7.0.6~mia8+dev) testing; urgency=medium
* Append "--quet" option to "mkfs.jfs".
......@@ -47,6 +93,14 @@ linstaller (7.0.6~mia4+dev) unstable; urgency=medium
-- Filip Danilovic <[email protected]> Wed, 30 Dec 2015 02:55:03 +0100
linstaller (7.0.6~mia3) stable; urgency=medium
* Add dh-python to build-deps.
* Made on "Fri, 08 Jan 2016 01:51:01 +0100"!
- Date changed due to merge conflict.
-- Filip Danilovic <[email protected]> Fri, 09 Oct 2015 01:51:01 +0100
linstaller (7.0.6~mia2) stable; urgency=medium
* Added refind install script.
......
Source: linstaller
Maintainer: Eugenio Paolantonio (g7) <[email protected]>
Maintainer: Filip Danilovic <[email protected]>
Section: python
Priority: optional
Build-Depends: python (>= 2.6.6-3), python2.7, debhelper (>= 7.4.3), dh-python
Build-Depends: debhelper (>= 7.4.3),
dh-python,
python (>= 2.6.6-3),
python2.7
Standards-Version: 3.9.4
X-Python-Version: >= 2.7
Vcs-Git: git://github.com/semplice/linstaller.git
Vcs-Browser: https://github.com/semplice/linstaller
Homepage: http://semplice.github.io/linstaller/
Vcs-Git: https://[email protected]/Cofi/trios-installer.git
Vcs-Browser: https://gitlab.com/Cofi/trios-installer
Homepage: https://gitlab.com/Cofi/trios-installer
Package: linstaller
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, linstaller-modules-base (= ${binary:Version}), linstaller-frontend-cli (= ${binary:Version}), python-apt
Depends: ${misc:Depends},
${python:Depends},
linstaller-frontend-cli (= ${binary:Version}),
linstaller-modules-base (= ${binary:Version}),
python-apt
Description: Modular GNU/Linux distribution installer
linstaller is a modular and preseedable GNU/Linux distribution
installer, written in python.
......@@ -34,7 +41,9 @@ Description: Modular GNU/Linux distribution installer -- xsession
Package: linstaller-frontend-cli
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-progressbar
Depends: ${misc:Depends},
${python:Depends},
python-progressbar
Description: Modular GNU/Linux distribution installer -- command line frontend
linstaller is a modular and preseedable GNU/Linux distribution
installer, written in python.
......@@ -46,7 +55,13 @@ Description: Modular GNU/Linux distribution installer -- command line frontend
Package: linstaller-frontend-glade
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, keeptalking (>= 2.21.0), pastebinit, python-gi, gir1.2-gtk-3.0, python-notify2
Depends: ${misc:Depends},
${python:Depends},
gir1.2-gtk-3.0,
keeptalking (>= 2.21.0),
pastebinit,
python-gi,
python-notify2
Description: Modular GNU/Linux distribution installer -- gtk3 frontend
linstaller is a modular and preseedable GNU/Linux distribution
installer, written in python.
......@@ -58,16 +73,31 @@ Description: Modular GNU/Linux distribution installer -- gtk3 frontend
Package: linstaller-modules-base
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, debconf, keeptalking, bricks, python-keeptalking, python-libbricks, python-t9n, python-parted, python-apt,
squashfs-tools,
user-setup,
imvirt,
lvm2,
cryptsetup,
util-linux,
parted,
ntfs-3g, fatresize, dosfstools, hfsprogs, reiserfsprogs, e2fsprogs,
xfsprogs, jfsutils, btrfs-tools
Depends: ${misc:Depends},
${python:Depends},
btrfs-tools,
cryptsetup,
debconf,
dosfstools,
e2fsprogs,
fatresize,
hfsprogs,
imvirt,
jfsutils,
keeptalking,
lvm2,
ntfs-3g,
os-prober,
parted,
python-apt,
python-keeptalking,
python-parted,
python-t9n (>= 6.0.2),
reiserfsprogs,
squashfs-tools,
user-setup,
util-linux,
xfsprogs
Description: Modular GNU/Linux distribution installer -- base modules
linstaller is a modular and preseedable GNU/Linux distribution
installer, written in python.
......@@ -80,7 +110,8 @@ Description: Modular GNU/Linux distribution installer -- base modules
Package: linstaller-config-trios
Architecture: all
Depends: linstaller (= ${binary:Version}), linstaller-modules-base (= ${binary:Version})
Depends: linstaller (= ${binary:Version}),
linstaller-modules-base (= ${binary:Version})
Description: Modular GNU/Linux distribution installer -- trios configuration
linstaller is a modular and preseedable GNU/Linux distribution
installer, written in python.
......@@ -91,9 +122,25 @@ Description: Modular GNU/Linux distribution installer -- trios configuration
This package contains the linstaller configuration files to
install Semplice Linux.
Package: linstaller-modules-bricks
Architecture: all
Depends: ${misc:Depends},
${python:Depends},
bricks,
python-libbricks
Description: Modular GNU/Linux distribution installer -- bricks module
linstaller is a modular and preseedable GNU/Linux distribution
installer, written in python.
.
It is Semplice Linux-oriented, but thanks to its configuration
system, can be adapted to many Live distributions.
.
This package contains the bricks module.
Package: live-config-linstaller
Architecture: all
Depends: ${misc:Depends}, live-config
Depends: ${misc:Depends},
live-config
Description: Additional Configuration Scripts for Debian Live (linstaller)
live-config contains the scripts needed to perform late-userspace actions
on Debian Live systems.
......
......@@ -16,7 +16,6 @@
/usr/share/linstaller/linstaller/modules/update
/usr/share/linstaller/linstaller/modules/userhost
/usr/share/linstaller/linstaller/modules/welcome
/usr/share/linstaller/linstaller/modules/bricks
/usr/share/linstaller/linstaller/modules/supportrepo
/usr/share/linstaller/linstaller/modules/virtualpartitions
/usr/share/linstaller/linstaller/modules/finish
......
/usr/share/linstaller/linstaller/modules/bricks
......@@ -9,6 +9,8 @@
import os, commands
import subprocess
import linstaller.core.main as m
import linstaller.core.libmodules.partdisks.library as lib
......@@ -62,14 +64,38 @@ class LUKSdrive:
except m.CmdError:
pass
# Ugly as hell
m.sexec("echo '%(password)s' | cryptsetup luksFormat --cipher %(cipher)s --key-size %(keysize)s %(device)s" % {"password":password, "device":self.string_device, "cipher":cipher, "keysize":keysize})
process = subprocess.Popen(
[
"cryptsetup",
"luksFormat",
"--cipher",
cipher,
"--key-size",
str(keysize),
self.string_device
],
stdin=subprocess.PIPE
)
process.communicate(password)
process.wait()
def open(self, password):
""" Opens the device. """
# Ugly as hell
m.sexec("echo '%(password)s' | cryptsetup luksOpen %(device)s %(name)s" % {"password":password, "device":self.string_device, "name":self.crypt_name})
process = subprocess.Popen(
[
"cryptsetup",
"luksOpen",
self.string_device,
self.crypt_name
],
stdin=subprocess.PIPE
)
process.communicate(password)
process.wait()
def close(self):
""" Closes the device. """
......
......@@ -11,6 +11,7 @@ import operator
import os
import commands
import time
import re
from linstaller.core.main import info,warn,verbose
......@@ -97,8 +98,19 @@ def is_disk(dsk):
It does perform checks only on the string passed, so it may not
be accurate. """
if not dsk[-1] in ("-","1","2","3","4","5","6","7","8","9","0"):
if "nvme" in dsk:
regexr = re.match(r"^nvme\d+n\d+$", dsk)
if regexr:
return True
else:
return False
elif "mmcblk" in dsk:
regexr = re.match(r"^mmcblk\d+$", dsk)
if regexr:
return True
else:
return False
elif not dsk[-1] in ("-","1","2","3","4","5","6","7","8","9","0"):
# Is a disk
return True
else:
......@@ -163,12 +175,53 @@ def return_device(dev):
if len(splitted) > 3:
# LVM LV.
return "/".join(splitted[:-1])
while dev[-1] in ("-","-1","1","2","3","4","5","6","7","8","9","0"):
dev = dev[:-1]
m.verbose("==> PARTLIB: \"return_device\" called with: %s" % dev)
if "nvme" in dev:
pattern = re.compile("(.*)p\d")
pattern2 = re.compile("(.*)p+-\d")
try:
result = pattern.search(dev).group(1)
m.verbose(" --> NVME detected, first pattern matches, returning: %s" % result)
return result
except AttributeError:
try:
result = pattern2.search(dev).group(1)
m.verbose(" --> NVME detected, second pattern matches, returning: %s" % result)
return result
except:
# This would probably be the device itself ( eg. "/dev/nvme0n1" )
# so, unless it turns out otherwise, just return it as-is.
m.verbose(" --> No matches with NVMe, returning original device: %s" % dev)
return dev
else:
while dev[-1] in ("-","-1","1","2","3","4","5","6","7","8","9","0"):
dev = dev[:-1]
m.verbose(" --> SATA/ATA detected, device is: %s" % dev)
if not dev:
m.verbose(" --> No matches at all, returning original device: %s" % dev)
return dev
def return_partition_number(partition):
""" Return a number from 'partition' (str), eg for '/dev/sda3' return 3 """
numbers = re.findall(r"\d+", partition)
partition_numbers = ""
check = ""
if numbers:
partition_number = numbers[-1]
m.verbose("LIB --> NUMBER IS: %s" % partition_number)
# Make sure it actually is a partition ( cannot be to safe )
if partition_number:
check = return_partition(partition)
if check:
return partition_number
else:
# TODO: Complain properly!!!
return None
def return_devices(onlyusb=False, withorder=False):
""" Returns a list of devices. """
......@@ -803,15 +856,15 @@ def umount_external(obj=False):
continue
if "/linstaller/target" in mountpoint:
verbose("Skipping...")
verbose("Skipping umount for %s..." % partition_path)
continue
else:
try:
verbose("Unmounting: %s" % partition_path)
umount(parted_part=partition)
verbose("Success!")
verbose("Successfully unmounted: %s" % partition_path)
except Exception as err:
verbose("Failed to unmount: %s\n%s" % (partition_path, err))
verbose("Failed to unmount: %s\nError was: %s" % (partition_path, err))
continue
return
......
......@@ -9,12 +9,13 @@ import linstaller.core.main as m
from linstaller.core.main import warn,info,verbose
from linstaller.core.libmodules.partdisks.library import check_distributions
from linstaller.core.libmodules.partdisks import library as lib
import os, sys, fileinput
import subprocess
import urllib2
import shutil
## Why are we using the "manual" install method instead of debconf?
## First, we want to keep some sort of compatibility with non-Debian
......@@ -80,7 +81,20 @@ class Install(module.Install):
# This workaround fixes that.
self.moduleclass.cache.change_rootdir("/")
self.moduleclass.cache = None
def get_efi_target_is_mac(self):
""" Returns True if the target /boot/efi partition is HFS+. """
# Get changed.
changed = self.moduleclass.modules_settings["partdisks"]["changed"]
for key, value in changed.items():
if value["changes"].get("useas", None) == "/boot/efi":
# Found our partition
return (value["obj"].fileSystem.type == "hfs+")
return False
def grub_install(self):
""" Installs grub. """
......@@ -89,6 +103,8 @@ class Install(module.Install):
verbose("Selected location: %s" % target)
efi_target_mac = False
if "uefidetect.inst" in self.moduleclass.modules_settings and self.moduleclass.modules_settings["uefidetect.inst"]["uefi"] == True:
# UEFI (need blank grub-install)
......@@ -100,7 +116,15 @@ class Install(module.Install):
arch = subprocess.check_output(["/usr/bin/dpkg-architecture", "-qDEB_BUILD_ARCH"]).strip()
else:
arch = "amd64"
# If the target /boot/efi partition is hfs+, it's highly
# probable that the system is a Mac.
try:
efi_target_mac = self.get_efi_target_is_mac()
except:
# Don't bother
pass
location = ""
args = "--target=%s" % UEFIplatforms[arch]
elif target == "root":
......@@ -153,14 +177,41 @@ class Install(module.Install):
db = debconf.DebconfCommunicator("linstaller")
db.set("grub-pc/install_devices", location)
db.shutdown() # Exit.
efidir = None
if efi_target_mac:
# grub-install hardcodes the installation to <efi-directory>/EFI/<vendor>,
# which is not supported on Macs. We will move the contents later,
# just obtain the installation path for now
efidir = os.path.join("/boot/efi/EFI", self.moduleclass.settings["grub_bootloader_id"])
if not os.path.exists(efidir):
os.makedirs(efidir)
# Create an empty mach_kernel file otherwise grub-install will
# fail
with open(os.path.join(efidir, "mach_kernel"), "w") as f:
f.write("Generated by linstaller\n")
# Ensure we install to the specified dir
args = "%s --efi-directory=/boot/efi --bootloader-id=%s" % (args, self.moduleclass.settings["grub_bootloader_id"])
m.sexec("grub-install %(args)s '%(location)s'" % {"args":args,"location":location})
if efi_target_mac and efidir:
# Finally move everything where it belongs
shutil.move(os.path.join(efidir, "mach_kernel"), "/boot/efi")
shutil.move(os.path.join(efidir, "System"), "/boot/efi")
# Copy icon if any
icon = self.moduleclass.settings["efi_volumeicon"]
if icon and os.path.exists(icon):
shutil.copy(icon, "/boot/efi/.VolumeIcon.icns")
should_hide_menu = self.moduleclass.modules_settings["bootloader"]["should_hide_menu"]
# Let's see if we can hide the GRUB menu...
if should_hide_menu:
distribs = check_distributions(caller="grub")
distribs = lib.check_distributions(caller="grub")
if distribs:
# Found other system, disable should_hide_menu
......@@ -170,8 +221,6 @@ class Install(module.Install):
if custom_init and not os.path.exists(custom_init):
# Semplice releases earlier than 6 do not ship a custom_init, so... hello kernel panics!
custom_init = None
custom_kernel_args = self.moduleclass.modules_settings["bootloader"]["custom_kernel_args"]
if "partdisks" in self.moduleclass.modules_settings and "swap" in self.moduleclass.modules_settings["partdisks"]:
swap = self.moduleclass.modules_settings["partdisks"]["swap"]
......@@ -187,17 +236,31 @@ class Install(module.Install):
# WARNING: Ugly-ness excess in this for
if line[0] != "#":
splitted = line.split("=")
if splitted[0] == "GRUB_CMDLINE_LINUX_DEFAULT" and swap:
sys.stdout.write("GRUB_CMDLINE_LINUX_DEFAULT=\"quiet resume=%s\"\n" % swap)
# FIXME: The above line overwrites the entire CMDLINE_DEFAULT. Also, 'swap' is used.
# We should decide if use it or its UUID.
elif splitted[0] == "GRUB_CMDLINE_LINUX" and custom_init and custom_kernel_args:
sys.stdout.write("GRUB_CMDLINE_LINUX=\"init=%s %s\"\n" % (custom_init, custom_kernel_args))
elif splitted[0] == "GRUB_CMDLINE_LINUX" and custom_init:
sys.stdout.write("GRUB_CMDLINE_LINUX=\"init=%s\"\n" % custom_init)
# FIXME: The above line overwrites the entire CMDLINE_LINUX.
elif splitted[0] == "GRUB_CMDLINE_LINUX" and custom_kernel_args:
sys.stdout.write("GRUB_CMDLINE_LINUX=\"%s\"\n" % custom_kernel_args)
if splitted[0] == "GRUB_CMDLINE_LINUX_DEFAULT":
to_append = []
if self.moduleclass.settings["grub_cmdline_linux_default"]:
to_append.append(self.moduleclass.settings["grub_cmdline_linux_default"])
if swap:
to_append.append("resume=%s" % swap)
if to_append:
sys.stdout.write("GRUB_CMDLINE_LINUX_DEFAULT=\"%s\"\n" % " ".join(to_append))
# FIXME: The above line overwrites the entire CMDLINE_DEFAULT. Also, 'swap' is used.
# We should decide if use it or its UUID.
else:
sys.stdout.write(line)
elif splitted[0] == "GRUB_CMDLINE_LINUX":
to_append = []
if self.moduleclass.settings["grub_cmdline_linux"]:
to_append.append(self.moduleclass.settings["grub_cmdline_linux"])
if custom_init:
to_append.append("init=%s" % custom_init)
if to_append:
sys.stdout.write("GRUB_CMDLINE_LINUX=\"%s\"\n" % " ".join(to_append))
# FIXME: The above line overwrites the entire CMDLINE_LINUX.
else:
sys.stdout.write(line)
elif splitted[0] == "GRUB_TIMEOUT" and should_hide_menu:
sys.stdout.write("# As there aren't other systems installed, the menu is disabled by default.\n")
sys.stdout.write("# Hold SHIFT during boot to open it.\n")
......@@ -223,8 +286,27 @@ class Install(module.Install):
""" Install REFIND """
if "uefidetect.inst" in self.moduleclass.modules_settings and self.moduleclass.modules_settings["uefidetect.inst"]["uefi"] == True:
try:
efi_part_mount = lib.is_mounted("/boot/efi")
except:
# No EFI partition. What now!?
m.verbose("EFI partition doesn't exist, or /boot/efi mount point is not set!")
pass
if efi_part_mount:
efi_part_path = efi_part_mount["path"]
efi_part_device = lib.return_device(efi_part_path)
efi_part_number = lib.return_partition_number(efi_part_path)
verbose("Installing refind...")
m.sexec("/refind-inst.sh")
verbose("PATH: %s -- DEV: %s -- NUM: %s" %(efi_part_path, efi_part_device, efi_part_number))
if "nvme" in efi_part_device or not "sda" in efi_part_device:
m.sexec("/refind-inst.sh -d %(device)s -p %(partition)s -v" % {"device":efi_part_device,"partition":efi_part_number})
elif "sda" in efi_part_device and efi_part_number > 1:
m.sexec("/refind-inst.sh -p %(partition)s -v" % {"partition":efi_part_number})
else:
m.sexec("/refind-inst.sh")
else:
pass
......@@ -271,3 +353,13 @@ class Module(module.Module):
self._install = {"grub":self.install.grub_install}
self._update = {"grub":self.install.grub_update}
self._refind_inst = {"grub":self.install.refind_install}
def seedpre(self):
"""
Caches settings.
"""
self.cache("grub_cmdline_linux_default")
self.cache("grub_cmdline_linux")
self.cache("grub_bootloader_id", "grub")
self.cache("efi_volumeicon", None)
......@@ -7,6 +7,8 @@
import linstaller.core.module as module
import linstaller.core.main as m
import os
class Install(module.Install):
def update_initramfs(self):
......@@ -17,6 +19,15 @@ class Install(module.Install):
m.verbose("Updating the initramfs...")
m.sexec("update-initramfs -u -k all")
def create_ssl_certs(self):
"""
Creates the missing SSL certs.
"""
if os.path.exists("/var/lib/dpkg/info/ssl-cert.list"):
# FIXME: saner check?
m.verbose("Creating SSL certs...")
m.sexec("make-ssl-cert generate-default-snakeoil --force-overwrite")
class Module(module.Module):
def _associate_(self):
......@@ -34,6 +45,8 @@ class Module(module.Module):
try:
# Update initramfs
self.install.update_initramfs()
# Create missing certs
self.install.create_ssl_certs()
finally:
# Exit
self.install.close()
......@@ -16,6 +16,12 @@ import linstaller.core.libmodules.partdisks.lvm as lvm
ZRAM_LIMIT = 2048 # If user's ram <= this value, zram will be configured.
FILESYSTEMS = {
"fat16" : "vfat",
"fat32" : "vfat",
"hfs+" : "hfsplus",
}
class Install(module.Install):
def generate(self):
""" Generates /etc/fstab. """
......@@ -59,7 +65,8 @@ proc /proc proc defaults 0 0
mountpoint = value["changes"]["useas"]
if not value["obj"].fileSystem: continue # Skip if fileSystem is None.
filesystem = value["obj"].fileSystem.type
if filesystem in ("fat32","fat16"): filesystem = "vfat"
if filesystem in FILESYSTEMS:
filesystem = FILESYSTEMS[filesystem]
if mountpoint == "/":
# root partition.
if filesystem == "ext4" or filesystem == "ext3" or filesystem == "ext2":
......
......@@ -38,11 +38,21 @@ class Install(module.Install):
if root:
db.set("passwd/root-login", "true")
db.set("passwd/root-password", rootpassword)
# Clear existing root pass, in case it exists:
try:
m.sexec("passwd -d root")
except:
m.verbose("Reseting preset root password failed!!!")
else:
db.set("passwd/root-login", "false")
# Groups
db.set("passwd/user-default-groups", "audio cdrom dip floppy video plugdev netdev powerdev scanner bluetooth debian-tor dialout fax tape fuse lpadmin")
db.set("passwd/user-default-groups",
self.moduleclass.settings["user_default_groups"]
+ " %s" % self.moduleclass.settings["user_additional_groups"]
if self.moduleclass.settings["user_additional_groups"]
else ""
)
# Make sure we make the user
db.set("passwd/make-user", "true")
......@@ -95,4 +105,29 @@ class Module(module.Module):
self.install = Install(self)
module.Module.start(self)
def seedpre(self):
"""
Cache settings.
"""
self.cache("user_default_groups", " ".join([
"audio",
"cdrom",
"dip",
"floppy",
"video",
"plugdev",
"netdev",
"powerdev",
"scanner",
"bluetooth",
"dialout",
"fax",
"tape",
"fuse",
"lpadmin"
]))
self.cache("user_additional_groups")