...
 
Commits (8)
/* Allow Calamares to be started without password authentication
*/
polkit.addRule(function(action, subject) {
if ((action.id == "com.github.calamares.calamares.pkexec.run"))
{
return polkit.Result.YES;
}
});
[Desktop Entry]
Type=Application
Version=1.0
Name=Install Manjaro Linux
GenericName=Live Installer
Comment=Install the operating system to disk
Comment[de]=Manjaro Linux installieren
Exec=/usr/bin/calamares_polkit %f
Icon=calamares
Terminal=false
StartupNotify=true
Type=Application
Categories=Qt;System;
#!/bin/bash
if [ $(which pkexec) ]; then
pkexec --disable-internal-agent "/usr/bin/calamares" "$@"
else
/usr/bin/calamares "$@"
fi
This diff is collapsed.
......@@ -30,7 +30,6 @@ modules-search: [ local ]
# For more information on running module instances, run Calamares in debug mode
# and check the Modules page in the Debug information interface.
# YAML: list of maps of string:string key-value pairs.
#instances:
#- id: owncloud
# module: webview
......@@ -59,46 +58,39 @@ modules-search: [ local ]
# instances are lifted.
# YAML: list of lists of strings.
sequence:
- show:
- welcome
# - dummypythonqt
- locale
- keyboard
- partition
- users
- summary
- exec:
# - dummycpp
# - dummyprocess
# - dummypython
# - dummypythonqt
- partition
- mount
- unpackfs
- machineid
- fstab
- locale
- keyboard
- localecfg
# - luksbootkeyfile
# - luksopenswaphookcfg
# - dracutlukscfg
# - plymouthcfg
- initcpiocfg
- initcpio
- users
- displaymanager
- networkcfg
- hwclock
- services
# - dracut
- initramfs
# - grubcfg
- bootloader
- umount
- show:
# - webview@owncloud
- finished
- show:
- welcome
- locale
- keyboard
- partition
- users
- summary
- exec:
- partition
- mount
- unpackfs
- machineid
- fstab
- locale
- keyboard
- localecfg
- luksopenswaphookcfg
- luksbootkeyfile
- plymouthcfg
- initcpiocfg
- initcpio
- users
- displaymanager
- mhwdcfg
- networkcfg
- hwclock
- services
- grubcfg
- bootloader
- postcfg
- umount
- show:
- finished
# A branding component is a directory, either in SHARE/calamares/branding or in
# /etc/calamares/branding (the latter takes precedence). The directory must contain a
......@@ -109,7 +101,7 @@ sequence:
# Only the name of the branding component (directory) should be specified here, Calamares
# then takes care of finding it and loading the contents.
# YAML: string.
branding: default
branding: manjaro
# If this is set to true, Calamares will show an "Are you sure?" prompt right before
# each execution phase, i.e. at points of no return. If this is set to false, no prompt
......
---
componentName: manjaro-kde
strings:
productName: Manjaro Linux
shortProductName: Manjaro
version: 17.0
shortVersion: 17.0
versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro
images:
productLogo: "squid.png"
productIcon: "logo.png"
productWelcome: "languages.png"
slideshow: "show.qml"
style:
sidebarBackground: "#292F34"
sidebarText: "#FFFFFF"
sidebarTextSelect: "#292F34"
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0;
import calamares.slideshow 1.0;
Presentation
{
id: presentation
Timer {
interval: 20000
running: true
repeat: true
onTriggered: presentation.goToNextSlide()
}
Slide {
Image {
id: background1
source: "slide1.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background1.horizontalCenter
anchors.top: background1.bottom
text: "Welcome to Manjaro.<br/>"+
"Manjaro is driven by a hardworking and dedicated community.<br/>"+
"During the installation, this slideshow will provide a quick introduction."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background2
source: "slide2.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background2.horizontalCenter
anchors.top: background2.bottom
text: "All of Manjaro's versions are completely customizable<br/>"+
"to exactly how you want it. From theming, to the very<br/>"+
"kernel itself, it can be changed."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background3
source: "slide3.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background3.horizontalCenter
anchors.top: background3.bottom
text: "Manjaro has three different officially supported editions.<br/>"+
"Additionally, there are a multitude of community editions<br/>"+
"to choose from, built by the community, for the community."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background4
source: "slide4.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background4.horizontalCenter
anchors.top: background4.bottom
text: "Manjaro has three different options for managing<br/>"+
"packages. The original command line option, Pacman<br/>"+
"and two different GUI options: Octopi or Pamac."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background5
source: "slide5.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background5.horizontalCenter
anchors.top: background5.bottom
text: "We appreciate you choosing Manjaro, and hope you enjoy<br/>"+
"it as much as we do making it! If you have any questions<br/>"+
"or feedback, please feel free to visit the forum, IRC, or wiki."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
}
---
componentName: manjaro-xfce
strings:
productName: Manjaro Linux
shortProductName: Manjaro
version: 17.0
shortVersion: 17.0
versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro
images:
productLogo: "squid.png"
productIcon: "logo.png"
productWelcome: "languages.png"
slideshow: "show.qml"
style:
sidebarBackground: "#292F34"
sidebarText: "#FFFFFF"
sidebarTextSelect: "#292F34"
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0;
import calamares.slideshow 1.0;
Presentation
{
id: presentation
Timer {
interval: 20000
running: true
repeat: true
onTriggered: presentation.goToNextSlide()
}
Slide {
Image {
id: background1
source: "slide1.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background1.horizontalCenter
anchors.top: background1.bottom
text: "Welcome to Manjaro.<br/>"+
"Manjaro is driven by a hardworking and dedicated community.<br/>"+
"During the installation, this slideshow will provide a quick introduction."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background2
source: "slide2.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background2.horizontalCenter
anchors.top: background2.bottom
text: "All of Manjaro's versions are completely customizable<br/>"+
"to exactly how you want it. From theming, to the very<br/>"+
"kernel itself, it can be changed."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background3
source: "slide3.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background3.horizontalCenter
anchors.top: background3.bottom
text: "Manjaro has three different officially supported editions.<br/>"+
"Additionally, there are a multitude of community editions<br/>"+
"to choose from, built by the community, for the community."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background4
source: "slide4.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background4.horizontalCenter
anchors.top: background4.bottom
text: "Manjaro has three different options for managing<br/>"+
"packages. The original command line option, Pacman<br/>"+
"and two different GUI options: Octopi or Pamac."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background5
source: "slide5.png"
width: 467; height: 280
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background5.horizontalCenter
anchors.top: background5.bottom
text: "We appreciate you choosing Manjaro, and hope you enjoy<br/>"+
"it as much as we do making it! If you have any questions<br/>"+
"or feedback, please feel free to visit the forum, IRC, or wiki."
wrapMode: Text.WordWrap
width: 600
horizontalAlignment: Text.Center
}
}
}
---
componentName: manjaro
strings:
productName: Manjaro Linux
shortProductName: Manjaro
version: 17.0
shortVersion: 17.0
versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro
images:
productLogo: "squid.png"
productIcon: "logo.png"
productWelcome: "languages.png"
slideshow: "show.qml"
style:
sidebarBackground: "#292F34"
sidebarText: "#FFFFFF"
sidebarTextSelect: "#292F34"
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Slides images dimensions are 800x440px.
*/
import QtQuick 2.0;
import calamares.slideshow 1.0;
Presentation
{
id: presentation
Timer {
interval: 20000
running: true
repeat: true
onTriggered: presentation.goToNextSlide()
}
Slide {
Image {
id: background1
source: "slide1.png"
width: 800; height: 440
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background1.horizontalCenter
anchors.top: background1.bottom
text: ""
wrapMode: Text.WordWrap
width: 800
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background2
source: "slide2.png"
width: 800; height: 440
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background2.horizontalCenter
anchors.top: background2.bottom
text: ""
wrapMode: Text.WordWrap
width: 800
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background3
source: "slide3.png"
width: 800; height: 440
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background3.horizontalCenter
anchors.top: background3.bottom
text: ""
wrapMode: Text.WordWrap
width: 800
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background4
source: "slide4.png"
width: 800; height: 440
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background4.horizontalCenter
anchors.top: background4.bottom
text: ""
wrapMode: Text.WordWrap
width: 800
horizontalAlignment: Text.Center
}
}
Slide {
Image {
id: background5
source: "slide5.png"
width: 800; height: 440
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
}
Text {
anchors.horizontalCenter: background5.horizontalCenter
anchors.top: background5.bottom
text: ""
wrapMode: Text.WordWrap
width: 800
horizontalAlignment: Text.Center
}
}
}
......@@ -5,15 +5,15 @@ efiBootLoader: "grub"
# systemd-boot configuration files settings, set kernel and initramfs file names
# and amount of time before default selection boots
kernel: "/vmlinuz-linux"
img: "/initramfs-linux.img"
fallback: "/initramfs-linux-fallback.img"
kernel: "_ALL_kver_"
img: "_default_image_"
fallback: "_fallback_image_"
timeout: "10"
# Optionally set the menu entry name and kernel name to use in systemd-boot.
# If not specified here, these settings will be taken from branding.desc.
# bootloaderEntryName: "Generic GNU/Linux"
# kernelLine: ", with Stable-Kernel"
# fallbackKernelLine: ", with Stable-Kernel (fallback initramfs)"
# bootloaderEntryName: "Manjaro"
kernelLine: ", with _manjaro_kernel_"
fallbackKernelLine: ", with _manjaro_kernel_ (fallback initramfs)"
# GRUB 2 binary names and boot directory
# Some distributions (e.g. Fedora) use grub2-* (resp. /boot/grub2/) names.
......
......@@ -9,7 +9,7 @@
# Copyright 2014, Benjamin Vaudour <benjamin.vaudour@yahoo.fr>
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
# Copyright 2015, Philip Mueller <philm@manjaro.org>
# Copyright 2016, Teo Mrnjavac <teo@kde.org>
# Copyright 2016-2017, Teo Mrnjavac <teo@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -294,6 +294,18 @@ def run():
if libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi":
return None
partitions = libcalamares.globalstorage.value("partitions")
if fw_type == "efi":
esp_found = False
for partition in partitions:
if partition["mountPoint"] == libcalamares.globalstorage.value("efiSystemPartition"):
esp_found = True
if not esp_found:
return None
prepare_bootloader(fw_type)
return None
---
requirements:
- name: /etc
mode: "0o755"
- name: /var/cache/pacman/pkg
mode: "0o755"
- name: /var/lib/pacman
mode: "0o755"
keyrings:
- archlinux
- manjaro
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2016, Artoo <artoo@manjaro.org>
#
# Calamares 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 3 of the License, or
# (at your option) any later version.
#
# Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
import os, shutil, subprocess, sys, re
import libcalamares
from libcalamares.utils import check_target_env_call, target_env_call, debug
from os.path import join
class OperationTracker:
def __init__(self):
self._downloaded = 0
self._installed = 0
self._total = 0
self._progress = float(0)
@property
def downloaded(self):
return self._downloaded
@downloaded.setter
def downloaded(self, value):
self._downloaded = value
@property
def installed(self):
return self._installed
@installed.setter
def installed(self, value):
self._installed = value
@property
def total(self):
return self._total
@total.setter
def total(self, value):
self._total = value
@property
def progress(self):
return self._progress
@progress.setter
def progress(self, value):
self._progress = value
def send_progress(self, counter, phase):
for p in range(phase):
if self.total == 0:
continue
step = 0.05
step += 0.95 * (counter / float(self.total))
self.progress += step / self.total
debug("Progress: {}".format(self.progress))
libcalamares.job.setprogress(self.progress)
ON_POSIX = 'posix' in sys.builtin_module_names
class PacmanController:
def __init__(self, root):
self.__root = root
self.__operations = libcalamares.globalstorage.value("packageOperations")
self.__tracker = OperationTracker()
self.__keyrings = libcalamares.job.configuration.get('keyrings', [])
@property
def tracker(self):
return self.__tracker
@property
def root(self):
return self.__root
@property
def operations(self):
return self.__operations
@property
def keyrings(self):
return self.__keyrings
def init_keyring(self):
target_env_call(["pacman-key", "--init"])
def populate_keyring(self):
target_env_call(["pacman-key", "--populate"] + self.keyrings)
def rank_mirrors(self):
check_target_env_call(["pacman-mirrors", "-g", "-m", "rank"])
def parse_output(self, cmd):
cal_env = os.environ
cal_env["LC_ALL"] = "C"
last = []
phase = 0
process = subprocess.Popen(cmd, env=cal_env, bufsize=1, stdout=subprocess.PIPE, close_fds=ON_POSIX)
for line in iter(process.stdout.readline, b''):
pkgs = re.findall(r'\((\d+)\)', line.decode())
dl = re.findall(r'downloading\s+(.*).pkg.tar.xz', line.decode())
inst = re.findall(r'installing(.*)\.\.\.', line.decode())
if pkgs:
self.tracker.total = (int(pkgs[0]))
debug("Number of packages: {}".format(self.tracker.total))
if dl:
if dl != last:
self.tracker.downloaded += 1
phase = 1
debug("Downloading: {}".format(dl[0]))
debug("Downloaded packages: {}".format(self.tracker.downloaded))
self.tracker.send_progress(self.tracker.downloaded, phase)
last = dl
elif inst:
self.tracker.installed += 1
phase = 2
debug("Installing: {}".format(inst[0]))
debug("Installed packages: {}".format(self.tracker.installed))
self.tracker.send_progress(self.tracker.installed, phase)
if process.returncode != 0:
return process.kill()
return None
def install(self, local=False):
cachedir = join(self.root, "var/cache/pacman/pkg")
dbdir = join(self.root, "var/lib/pacman")
args = ["pacman", "--noconfirm"]
if local:
args.extend(["-U"])
else:
args.extend(["-Sy"])
args.extend(["--cachedir", cachedir, "--root", self.root, "--dbpath", dbdir])
cmd = args + self.operations["install"]
self.parse_output(cmd)
def remove(self):
args = ["chroot", self.root, "pacman", "-Rs", "--noconfirm"]
cmd = args + self.operations["remove"]
check_target_env_call(cmd)
def run(self, rank=False):
for op in self.operations.keys():
if op == "install":
self.install()
elif op == "localInstall":
self.install(local=True)
elif op == "remove":
self.tracker.total(len(self.operations["remove"]))
self.remove()
self.init_keyring()
self.populate_keyring()
if rank:
self.rank_mirrors()
return None
class ChrootController:
def __init__(self):
self.__root = libcalamares.globalstorage.value('rootMountPoint')
self.__requirements = libcalamares.job.configuration.get('requirements', [])
@property
def root(self):
return self.__root
@property
def requirements(self):
return self.__requirements
def make_dirs(self):
for target in self.requirements:
dest = self.root + target["name"]
if not os.path.exists(dest):
debug("Create: {}".format(dest))
mod = int(target["mode"],8)
debug("Mode: {}".format(oct(mod)))
os.makedirs(dest, mode=mod)
def copy_file(self, file):
if os.path.exists(os.path.join("/",file)):
shutil.copy2(os.path.join("/",file), os.path.join(self.root, file))
def prepare(self):
cal_umask = os.umask(0)
self.make_dirs()
path = join(self.root, "run")
#debug("Fix permissions: {}".format(path))
os.chmod(path, 0o755)
os.umask(cal_umask)
self.copy_file('etc/pacman-mirrors.conf')
self.copy_file('etc/resolv.conf')
def run(self):
self.prepare()
pacman = PacmanController(self.root)
return pacman.run(rank=False)
def run():
""" Create chroot dirs and install pacman, kernel and netinstall selection """
targetRoot = ChrootController()
return targetRoot.run()
# Syntax is YAML 1.2
---
type: "job"
name: "chrootcfg"
interface: "python"
script: "main.py" #assumed relative to the current directory
......@@ -32,6 +32,8 @@ DesktopEnvironment = collections.namedtuple('DesktopEnvironment', ['executable',
desktop_environments = [
DesktopEnvironment('/usr/bin/startkde', 'plasma'), # KDE Plasma 5
DesktopEnvironment('/usr/bin/startkde', 'kde-plasma'), # KDE Plasma 4
DesktopEnvironment('/usr/bin/budgie-desktop', 'budgie-desktop'), # Budgie v10.x
DesktopEnvironment('/usr/bin/budgie-session', 'budgie-desktop'), # Budgie v8.x
DesktopEnvironment('/usr/bin/gnome-session', 'gnome'),
DesktopEnvironment('/usr/bin/startxfce4', 'xfce'),
DesktopEnvironment('/usr/bin/cinnamon-session-cinnamon', 'cinnamon'),
......@@ -42,8 +44,6 @@ desktop_environments = [
DesktopEnvironment('/usr/bin/lxqt-session', 'lxqt'),
DesktopEnvironment('/usr/bin/pekwm', 'pekwm'),
DesktopEnvironment('/usr/bin/pantheon-session', 'pantheon'),
DesktopEnvironment('/usr/bin/budgie-session', 'budgie-session'),
DesktopEnvironment('/usr/bin/budgie-desktop', 'budgie-desktop'),
DesktopEnvironment('/usr/bin/i3', 'i3'),
DesktopEnvironment('/usr/bin/startdde', 'deepin'),
DesktopEnvironment('/usr/bin/openbox-session', 'openbox')
......
......@@ -4,7 +4,7 @@
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014-2015, Philip Müller <philm@manjaro.org>
# Copyright 2015, Teo Mrnjavac <teo@kde.org>
# Copyright 2015-2017, Teo Mrnjavac <teo@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -23,6 +23,7 @@ import libcalamares
import os
import re
def modify_grub_default(partitions, root_mount_point, distributor):
""" Configures '/etc/default/grub' for hibernation and plymouth.
......@@ -65,7 +66,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
"cryptdevice=UUID={!s}:{!s}".format(partition["luksUuid"],
partition["luksMapperName"]),
"root=/dev/mapper/{!s}".format(partition["luksMapperName"])
]
]
kernel_params = ["quiet"]
......@@ -162,10 +163,24 @@ def run():
:return:
"""
if libcalamares.globalstorage.value("bootLoader") is None:
fw_type = libcalamares.globalstorage.value("firmwareType")
if libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi":
return None
partitions = libcalamares.globalstorage.value("partitions")
if fw_type == "efi":
esp_found = False
for partition in partitions:
if partition["mountPoint"] == libcalamares.globalstorage.value("efiSystemPartition"):
esp_found = True
if not esp_found:
return None
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
branding = libcalamares.globalstorage.value("branding")
distributor = branding["bootloaderEntryName"]
......
---
kernel: linux312
kernel: _kernel_
---
region: "America"
zone: "New_York"
region: "America"
zone: "New_York"
# GeoIP settings. Leave commented out to disable GeoIP.
#localeGenPath: "/etc/locale.gen"
#geoipUrl: "freegeoip.net"
localeGenPath: "/etc/locale.gen"
geoipUrl: "freegeoip.net"
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2016, Artoo <artoo@manjaro.org>
#
# Calamares 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 3 of the License, or
# (at your option) any later version.
#
# Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
from libcalamares.utils import target_env_call, debug
from os.path import join
from subprocess import call
class MhwdController:
def __init__(self):
self.__root = libcalamares.globalstorage.value( "rootMountPoint" )
self.__bus = libcalamares.job.configuration.get('bus', [])
self.__identifier = libcalamares.job.configuration.get('identifier', [])
self.__local = libcalamares.job.configuration['local']
self.__repo = libcalamares.job.configuration['repo']
self._driver = libcalamares.job.configuration['driver']
@property
def driver(self):
return self._driver
@driver.setter
def driver(self, value):
self._driver = value
@property
def root(self):
return self.__root
@property
def local(self):
return self.__local
@property
def repo(self):
return self.__repo
@property
def identifier(self):
return self.__identifier
@property
def bus(self):
return self.__bus
def umount(self, mp):
call(["umount", "-l", join(self.root, mp)])
def mount(self, mp):
call(["mount", "-Br", "/" + mp, join(self.root, mp)])
def configure(self, name, id):
cmd = ["mhwd", "-a", str(name), str(self.driver), str(id).zfill(4)]
if self.local:
self.mount("opt")
cmd.extend(["--pmconfig", self.repo])
self.mount("etc/resolv.conf")
target_env_call(cmd)
if self.local:
self.umount("opt")
self.umount("etc/resolv.conf")
def run(self):
for b in self.bus:
for id in self.identifier['net']:
self.configure(b, id)
for id in self.identifier['video']:
self.configure(b, id)
return None
def run():
""" Configure the hardware """
mhwd = MhwdController()
return mhwd.run()
---
bus:
- pci
# - usb
identifier:
net:
- 200
- 280
video:
- 300
- 302
- 380
driver: free
local: true
repo: /opt/pacman-mhwd.conf
# Syntax is YAML 1.2
---
type: "job"
name: "mhwdcfg"
interface: "python"
script: "main.py" #assumed relative to the current directory
......@@ -16,11 +16,11 @@ The *netinstall.conf* file should have this format:
The URL must point to a YAML file. Here is a short example of how the YAML file should look.
- name: "Group name"
description: "Description of the group"
packages:
- lsb-release
- avahi
- grub
description: "Description of the group"
packages:
- lsb-release
- avahi
- grub
- name: "Second group name"
...
......@@ -37,6 +37,12 @@ More keys are supported:
- subgroups: if present this follows the same structure as the top level
of the YAML file, allowing there to be sub-groups of packages to an
arbitary depth
- pre-install: an optional command to run within the new system before
the group's packages are installed. It will run before each package in
the group is installed.
- post-install: an optional command to run within the new system after
the group's packages are installed. It will run after each package in
the group is installed.
If you set both *hidden* and *selected* for a group, you are basically creating a "default" group of packages
which will always be installed in the user's system.
......
......@@ -112,7 +112,7 @@ class PackageManager:
def run(self, script):
if script != "":
check_target_env_call(scrtip.split(" "))
check_target_env_call(script.split(" "))
def subst_locale(list):
......@@ -138,13 +138,13 @@ def run_operations(pkgman, entry):
for key in entry.keys():
entry[key] = subst_locale(entry[key])
if key == "install":
if isinstance(package, str):
pkgman.install(entry[key])
else:
if isinstance(entry[key], list):
for package in entry[key]:
pkgman.run(package["pre-script"])
pkgman.install([package["package"]])
pkgman.run(package["post-script"])
else:
pkgman.install(entry[key])
elif key == "try_install":
# we make a separate package manager call for each package so a single
# failing package won't stop all of them
......
rootMountPoint: /tmp/mount
packageOperations:
- install:
- vi
- pre-script: touch /tmp/foo
package: vi
post-script: rm /tmp/foo
- wget
- remove:
- vi
- wget
......@@ -100,13 +100,13 @@ swapSuggestion( const qint64 availableSpaceB )
void
doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPassphrase )
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
bool isEfi = false;
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
isEfi = true;
QString defaultFsType = Calamares::JobQueue::instance()->
globalStorage()->
value( "defaultFileSystemType" ).toString();
QString defaultFsType = gs->value( "defaultFileSystemType" ).toString();
if ( FileSystem::typeForName( defaultFsType ) == FileSystem::Unknown )
defaultFsType = "ext4";
......@@ -144,9 +144,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionTable::FlagEsp
);
PartitionInfo::setFormat( efiPartition, true );
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()
->globalStorage()
->value( "efiSystemPartition" )
PartitionInfo::setMountPoint( efiPartition, gs->value( "efiSystemPartition" )
.toString() );
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp | PartitionTable::FlagBoot );
firstFreeSector = lastSector + 1;
......@@ -156,17 +154,21 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
core->createPartitionTable( dev, PartitionTable::msdos );
}
const bool mayCreateSwap = !gs->value( "neverCreateSwap" ).toBool();
bool shouldCreateSwap = false;
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB =
( Calamares::JobQueue::instance()->
globalStorage()->
value( "requiredStorageGB" ).toDouble() + 0.1 + 2.0 ) GiB +
suggestedSwapSizeB;
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
shouldCreateSwap = availableSpaceB > requiredSpaceB;
qint64 suggestedSwapSizeB = 0;
if ( mayCreateSwap )
{
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB =
( gs->value( "requiredStorageGB" ).toDouble() + 0.1 + 2.0 ) GiB +
suggestedSwapSizeB;
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
shouldCreateSwap = availableSpaceB > requiredSpaceB;
}
qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device
if ( shouldCreateSwap )
......
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -503,6 +503,16 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
gs->insert( "ensureSuspendToDisk", true );
}
if ( configurationMap.contains( "neverCreateSwap" ) &&
configurationMap.value( "neverCreateSwap" ).type() == QVariant::Bool )
{
gs->insert( "neverCreateSwap", configurationMap.value( "neverCreateSwap" ).toBool() );
}
else
{
gs->insert( "neverCreateSwap", false );
}
if ( configurationMap.contains( "drawNestedPartitions" ) &&
configurationMap.value( "drawNestedPartitions" ).type() == QVariant::Bool )
{
......
......@@ -3,9 +3,16 @@
# etc.) use just /boot.
efiSystemPartition: "/boot/efi"
# Make sure an autogenerated swap partition is big enough for hibernation
# Make sure an autogenerated swap partition is big enough for hibernation in
# automated partitioning modes.
# Default is true.
ensureSuspendToDisk: true
# Never create swap partitions in automated partitioning modes.
# If this is true, ensureSuspendToDisk is ignored.
# Default is false.
neverCreateSwap: false
# Correctly draw nested (e.g. logical) partitions as such.
drawNestedPartitions: false
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014 - 2016, Philip Müller <philm@manjaro.org>
# Copyright 2016, Artoo <artoo@manjaro.org>
#
# Calamares 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 3 of the License, or
# (at your option) any later version.
#
# Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
from shutil import copy2
from distutils.dir_util import copy_tree
from os.path import join, exists
from libcalamares.utils import target_env_call
class ConfigController:
def __init__(self):
self.__root = libcalamares.globalstorage.value("rootMountPoint")
self.__keyrings = libcalamares.job.configuration.get('keyrings', [])
@property
def root(self):
return self.__root
@property
def keyrings(self):
return self.__keyrings
def init_keyring(self):
target_env_call(["pacman-key", "--init"])
def populate_keyring(self):
target_env_call(["pacman-key", "--populate"] + self.keyrings)
def terminate(self, proc):
target_env_call(['killall', '-9', proc])
def copy_file(self, file):
if exists("/" + file):
copy2("/" + file, join(self.root, file))
def copy_folder(self, source, target):
if exists("/" + source):
copy_tree("/" + source, join(self.root, target))
def remove_pkg(self, pkg, path):
if exists(join(self.root, path)):
target_env_call(['pacman', '-R', '--noconfirm', pkg])
def run(self):
self.init_keyring()
self.populate_keyring()
# Remove calamares
self.remove_pkg("calamares", "usr/bin/calamares")
# Generate mirror list
if exists(join(self.root, "usr/bin/pacman-mirrors")):
if libcalamares.globalstorage.value("hasInternet"):
target_env_call(["pacman-mirrors", "-g"])
else:
self.copy_file('etc/pacman.d/mirrorlist')
# Copy skel to root
self.copy_folder('etc/skel', 'root')
# Workaround for pacman-key bug FS#45351 https://bugs.archlinux.org/task/45351
# We have to kill gpg-agent because if it stays around we can't reliably unmount
# the target partition.
self.terminate('gpg-agent')
# Update grub.cfg
if exists(join(self.root, "usr/bin/update-grub")) and libcalamares.globalstorage.value("bootLoader") is not None:
target_env_call(["update-grub"])
return None
def run():
""" Misc postinstall configurations """
config = ConfigController()
return config.run()
# Syntax is YAML 1.2
---
type: "job"
name: "postcfg"
interface: "python"
script: "main.py" #assumed relative to the current directory
---
keyrings:
- archlinux
- manjaro
......@@ -3,8 +3,9 @@
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>
# Copyright 2014-2016, Philip Müller <philm@manjaro.org>
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
# Copyright 2016, Artoo <artoo@manjaro.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -20,6 +21,7 @@
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
from os.path import join, exists
def run():
......@@ -27,6 +29,7 @@ def run():
services = libcalamares.job.configuration['services']
targets = libcalamares.job.configuration['targets']
disable = libcalamares.job.configuration['disable']
rootmnt = libcalamares.globalstorage.value("rootMountPoint")
# note that the "systemctl enable" and "systemctl disable" commands used
# here will work in a chroot; in fact, they are the only systemctl commands
......@@ -67,5 +70,17 @@ def run():
else:
libcalamares.utils.debug("Cannot disable systemd service {}".format(dbl['name']))
libcalamares.utils.debug("systemctl disable call in chroot returned error code {}".format(ec))
if libcalamares.globalstorage.contains("displayManagers"):
for dm in libcalamares.globalstorage.value("displayManagers"):
if not exists(join(rootmnt, "etc/systemd/system/display-manager.service")):
ec = libcalamares.utils.target_env_call(['systemctl', 'enable', '{}.service'.format(dm)])