2015-01-29 05:12:17 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# 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; version 2 of the License.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_machineid_conf(){
|
2016-06-10 11:55:41 +02:00
|
|
|
local conf="$1/etc/calamares/modules/machineid.conf"
|
2016-07-30 17:04:28 +02:00
|
|
|
if [[ ${initsys} == 'openrc' ]];then
|
|
|
|
echo "systemd: false" > $conf
|
|
|
|
echo "dbus: true" >> $conf
|
|
|
|
echo "symlink: true" >> $conf
|
|
|
|
else
|
|
|
|
echo "systemd: true" > $conf
|
|
|
|
echo "dbus: true" >> $conf
|
|
|
|
echo "symlink: true" >> $conf
|
|
|
|
fi
|
2015-01-29 05:12:17 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_finished_conf(){
|
2015-02-13 01:21:57 +01:00
|
|
|
local conf="$1/etc/calamares/modules/finished.conf"
|
|
|
|
echo '---' > "$conf"
|
|
|
|
echo 'restartNowEnabled: true' >> "$conf"
|
|
|
|
echo 'restartNowChecked: false' >> "$conf"
|
2016-07-30 17:04:28 +02:00
|
|
|
if [[ ${initsys} == 'openrc' ]];then
|
|
|
|
echo 'restartNowCommand: "shutdown -r now"' >> "$conf"
|
|
|
|
else
|
|
|
|
echo 'restartNowCommand: "systemctl -i reboot"' >> "$conf"
|
|
|
|
fi
|
2015-02-11 14:06:44 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_bootloader_conf(){
|
2015-03-05 10:54:09 +01:00
|
|
|
source "$1/etc/mkinitcpio.d/${kernel}.preset"
|
2015-02-19 21:52:12 +01:00
|
|
|
local conf="$1/etc/calamares/modules/bootloader.conf"
|
|
|
|
echo '---' > "$conf"
|
2015-02-20 17:36:24 +01:00
|
|
|
echo "efiBootLoader: \"${efi_boot_loader}\"" >> "$conf"
|
2015-02-19 23:30:32 +01:00
|
|
|
echo "kernel: \"$(echo ${ALL_kver} | sed s'|/boot||')\"" >> "$conf"
|
2015-02-19 23:24:11 +01:00
|
|
|
echo "img: \"$(echo ${default_image} | sed s'|/boot||')\"" >> "$conf"
|
|
|
|
echo "fallback: \"$(echo ${fallback_image} | sed s'|/boot||')\"" >> "$conf"
|
2015-06-17 10:14:22 +02:00
|
|
|
echo 'timeout: "10"' >> "$conf"
|
2015-03-05 10:54:09 +01:00
|
|
|
echo "kernelLine: \", with ${kernel}\"" >> "$conf"
|
|
|
|
echo "fallbackKernelLine: \", with ${kernel} (fallback initramfs)\"" >> "$conf"
|
2015-02-19 21:52:12 +01:00
|
|
|
echo 'grubInstall: "grub-install"' >> "$conf"
|
|
|
|
echo 'grubMkconfig: "grub-mkconfig"' >> "$conf"
|
|
|
|
echo 'grubCfg: "/boot/grub/grub.cfg"' >> "$conf"
|
2015-06-17 10:14:22 +02:00
|
|
|
echo '#efiBootloaderId: "dirname"' >> "$conf"
|
2015-02-19 21:52:12 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_services_conf(){
|
2015-02-13 01:21:57 +01:00
|
|
|
local conf="$1/etc/calamares/modules/services.conf"
|
|
|
|
echo '---' > "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
if [[ ${initsys} == 'openrc' ]];then
|
|
|
|
echo 'services:' >> "$conf"
|
|
|
|
for s in ${start_openrc[@]};do
|
|
|
|
echo ' - name: '"$s" >> "$conf"
|
|
|
|
echo ' mandatory: false' >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
done
|
|
|
|
echo 'targets:' >> "$conf"
|
|
|
|
echo ' - name: "graphical"' >> "$conf"
|
|
|
|
echo ' mandatory: false' >> "$conf"
|
2015-09-12 12:42:54 +02:00
|
|
|
echo '' >> "$conf"
|
2015-09-12 12:29:52 +02:00
|
|
|
echo 'disable:' >> "$conf"
|
|
|
|
for s in ${disable_openrc[@]};do
|
|
|
|
echo ' - name: '"$s" >> "$conf"
|
|
|
|
echo ' mandatory: false' >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
2015-02-13 01:21:57 +01:00
|
|
|
done
|
2015-09-18 08:35:22 +02:00
|
|
|
else
|
|
|
|
echo 'services:' > "$conf"
|
|
|
|
for s in ${start_systemd[@]};do
|
|
|
|
echo ' - name: '"$s" >> "$conf"
|
|
|
|
echo ' mandatory: false' >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
done
|
2015-02-13 01:21:57 +01:00
|
|
|
echo 'targets:' >> "$conf"
|
|
|
|
echo ' - name: "graphical"' >> "$conf"
|
|
|
|
echo ' mandatory: true' >> "$conf"
|
2015-09-18 08:35:22 +02:00
|
|
|
echo '' >> "$conf"
|
2015-09-12 12:29:52 +02:00
|
|
|
echo 'disable:' >> "$conf"
|
|
|
|
for s in ${disable_systemd[@]};do
|
|
|
|
echo ' - name: '"$s" >> "$conf"
|
|
|
|
echo ' mandatory: false' >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
2015-09-12 12:42:54 +02:00
|
|
|
done
|
2015-02-13 01:21:57 +01:00
|
|
|
fi
|
2015-02-11 14:06:44 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_displaymanager_conf(){
|
2015-02-13 01:21:57 +01:00
|
|
|
local conf="$1/etc/calamares/modules/displaymanager.conf"
|
|
|
|
echo "displaymanagers:" > "$conf"
|
|
|
|
echo " - ${displaymanager}" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
2016-06-10 11:55:41 +02:00
|
|
|
if $(is_valid_de); then
|
2015-05-31 01:26:28 +02:00
|
|
|
echo "defaultDesktopEnvironment:" >> "$conf"
|
|
|
|
echo " executable: \"${default_desktop_executable}\"" >> "$conf"
|
|
|
|
echo " desktopFile: \"${default_desktop_file}\"" >> "$conf"
|
|
|
|
fi
|
2015-02-13 01:21:57 +01:00
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "basicSetup: false" >> "$conf"
|
2015-01-29 05:12:17 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_initcpio_conf(){
|
2015-02-13 01:21:57 +01:00
|
|
|
local conf="$1/etc/calamares/modules/initcpio.conf"
|
|
|
|
echo "---" > "$conf"
|
2015-03-05 10:54:09 +01:00
|
|
|
echo "kernel: ${kernel}" >> "$conf"
|
2015-01-29 05:12:17 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_unpack_conf(){
|
2015-02-13 01:21:57 +01:00
|
|
|
local conf="$1/etc/calamares/modules/unpackfs.conf"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "unpack:" >> "$conf"
|
2016-06-06 20:08:09 +02:00
|
|
|
echo " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf"
|
2015-02-13 01:21:57 +01:00
|
|
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
|
|
|
echo " destination: \"\"" >> "$conf"
|
2016-07-30 16:26:46 +02:00
|
|
|
if [[ -f /bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs ]];then
|
|
|
|
echo " - source: \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf"
|
|
|
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
|
|
|
echo " destination: \"\"" >> "$conf"
|
|
|
|
fi
|
2015-02-12 20:43:53 +01:00
|
|
|
}
|
2015-01-29 05:12:17 +01:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_users_conf(){
|
2015-02-13 21:38:41 +01:00
|
|
|
local conf="$1/etc/calamares/modules/users.conf"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "userGroup: users" >> "$conf"
|
|
|
|
echo "defaultGroups:" >> "$conf"
|
2015-02-13 22:07:41 +01:00
|
|
|
local IFS=','
|
2015-02-13 21:38:41 +01:00
|
|
|
for g in ${addgroups[@]};do
|
|
|
|
echo " - $g" >> "$conf"
|
|
|
|
done
|
2015-02-13 22:07:41 +01:00
|
|
|
unset IFS
|
2015-02-13 21:38:41 +01:00
|
|
|
echo "autologinGroup: autologin" >> "$conf"
|
|
|
|
echo "sudoersGroup: wheel" >> "$conf"
|
2015-09-26 21:56:24 +02:00
|
|
|
echo "setRootPassword: true" >> "$conf"
|
2015-02-13 21:38:41 +01:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_packages_conf(){
|
2016-07-29 01:12:51 +02:00
|
|
|
local conf="$1/etc/calamares/modules/packages.conf"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "backend: pacman" >> "$conf"
|
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_welcome_conf(){
|
2016-07-29 01:12:51 +02:00
|
|
|
local conf="$1/etc/calamares/modules/welcome.conf"
|
|
|
|
echo "---" > "$conf" >> "$conf"
|
|
|
|
echo "showSupportUrl: true" >> "$conf"
|
|
|
|
echo "showKnownIssuesUrl: true" >> "$conf"
|
|
|
|
echo "showReleaseNotesUrl: true" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "requirements:" >> "$conf"
|
|
|
|
echo "requiredStorage: 5.5" >> "$conf"
|
|
|
|
echo "requiredRam: 1.0" >> "$conf"
|
|
|
|
echo "check:" >> "$conf"
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - storage" >> "$conf"
|
|
|
|
echo " - ram" >> "$conf"
|
|
|
|
echo " - power" >> "$conf"
|
|
|
|
echo " - internet" >> "$conf"
|
|
|
|
echo " - root" >> "$conf"
|
2016-07-29 01:12:51 +02:00
|
|
|
echo "required:" >> "$conf"
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - storage" >> "$conf"
|
|
|
|
echo " - ram" >> "$conf"
|
|
|
|
echo " - root" >> "$conf"
|
|
|
|
${cal_netinstall} && echo " - internet" >> "$conf"
|
2016-07-29 01:12:51 +02:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_settings_conf(){
|
2016-07-29 01:12:51 +02:00
|
|
|
local conf="$1/etc/calamares/settings.conf"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "modules-search: [ local ]" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "instances:" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "sequence:" >> "$conf"
|
|
|
|
echo "- show:" >> "$conf"
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - welcome" >> "$conf"
|
|
|
|
${cal_netinstall} && echo " - netinstall" >> "$conf"
|
|
|
|
echo " - locale" >> "$conf"
|
|
|
|
echo " - keyboard" >> "$conf"
|
|
|
|
echo " - partition" >> "$conf"
|
|
|
|
echo " - users" >> "$conf"
|
|
|
|
echo " - summary" >> "$conf"
|
2016-07-29 01:12:51 +02:00
|
|
|
echo "- exec:" >> "$conf"
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - partition" >> "$conf"
|
|
|
|
echo " - mount" >> "$conf"
|
2016-07-29 01:12:51 +02:00
|
|
|
if ${cal_netinstall};then
|
2016-07-30 16:26:46 +02:00
|
|
|
if ${cal_unpackfs};then
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - unpackfs" >> "$conf"
|
2016-08-01 16:58:18 +02:00
|
|
|
echo " - networkcfg" >> "$conf"
|
2016-08-01 16:54:52 +02:00
|
|
|
echo " - packages" >> "$conf"
|
2016-07-30 16:26:46 +02:00
|
|
|
else
|
2016-08-01 21:44:19 +02:00
|
|
|
# take out networkcfg once a new PR has been merged
|
|
|
|
echo " - networkcfg" >> "$conf"
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - chrootcfg" >> "$conf"
|
2016-07-30 16:26:46 +02:00
|
|
|
fi
|
2016-07-30 16:43:17 +02:00
|
|
|
else
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - unpackfs" >> "$conf"
|
2016-08-01 16:58:18 +02:00
|
|
|
echo " - networkcfg" >> "$conf"
|
2015-03-28 06:54:13 +01:00
|
|
|
fi
|
2016-07-30 19:39:01 +02:00
|
|
|
echo " - machineid" >> "$conf"
|
|
|
|
echo " - fstab" >> "$conf"
|
|
|
|
echo " - locale" >> "$conf"
|
|
|
|
echo " - keyboard" >> "$conf"
|
|
|
|
echo " - localegen" >> "$conf"
|
|
|
|
echo " - luksopenswaphookcfg" >> "$conf"
|
|
|
|
echo " - luksbootkeyfile" >> "$conf"
|
|
|
|
echo " - initcpiocfg" >> "$conf"
|
|
|
|
echo " - initcpio" >> "$conf"
|
|
|
|
echo " - users" >> "$conf"
|
|
|
|
echo " - displaymanager" >> "$conf"
|
|
|
|
echo " - hardwarecfg" >> "$conf"
|
|
|
|
echo " - networkcfg" >> "$conf"
|
|
|
|
echo " - hwclock" >> "$conf"
|
|
|
|
echo " - services" >> "$conf"
|
|
|
|
echo " - grubcfg" >> "$conf"
|
|
|
|
echo " - bootloader" >> "$conf"
|
|
|
|
echo " - postcfg" >> "$conf"
|
|
|
|
echo " - umount" >> "$conf"
|
|
|
|
echo "- show:" >> "$conf"
|
|
|
|
echo " - finished" >> "$conf"
|
2016-07-29 01:12:51 +02:00
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "branding: ${iso_name}" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "prompt-install: false" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "dont-chroot: false" >> "$conf"
|
2015-03-28 06:54:13 +01:00
|
|
|
}
|
|
|
|
|
2016-07-31 23:58:51 +02:00
|
|
|
write_chrootcfg_conf(){
|
|
|
|
local conf="$1/etc/calamares/modules/chrootcfg.conf"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "requirements:" >> "$conf"
|
2016-08-01 11:03:18 +02:00
|
|
|
echo " - directory: /etc" >> "$conf"
|
|
|
|
echo " - directory: /var/log" >> "$conf"
|
|
|
|
echo " - directory: /var/cache/pacman/pkg" >> "$conf"
|
|
|
|
echo " - directory: /var/lib/pacman" >> "$conf"
|
2016-07-31 23:58:51 +02:00
|
|
|
echo '' >> "$conf"
|
2016-08-01 11:03:18 +02:00
|
|
|
echo "packages:" >> "$conf"
|
|
|
|
echo " - pacman" >> "$conf"
|
|
|
|
echo " - ${kernel}" >> "$conf"
|
2016-08-01 21:44:19 +02:00
|
|
|
# take out until a new PR has been merged
|
|
|
|
# echo '' >> "$conf"
|
|
|
|
# echo "keyrings:" >> "$conf"
|
|
|
|
# echo " - archlinux" >> "$conf"
|
|
|
|
# echo " - manjaro" >> "$conf"
|
2016-07-31 23:58:51 +02:00
|
|
|
}
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_netinstall_conf(){
|
|
|
|
local conf="$1/etc/calamares/modules/netinstall.conf"
|
|
|
|
echo "---" > "$conf"
|
2016-07-31 23:58:51 +02:00
|
|
|
echo "groupsUrl: ${cal_netgroups}" >> "$conf"
|
2016-07-30 21:31:07 +02:00
|
|
|
}
|
|
|
|
|
2015-01-29 05:12:17 +01:00
|
|
|
configure_calamares(){
|
2015-07-12 17:00:54 +02:00
|
|
|
msg2 "Configuring Calamares ..."
|
2016-07-30 17:04:28 +02:00
|
|
|
|
2015-07-12 17:00:54 +02:00
|
|
|
mkdir -p $1/etc/calamares/modules
|
2016-07-30 17:04:28 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_settings_conf "$1"
|
|
|
|
|
|
|
|
write_welcome_conf "$1"
|
2016-07-29 01:12:51 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_packages_conf "$1"
|
2016-07-29 01:12:51 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_bootloader_conf "$1"
|
2016-07-29 01:12:51 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_unpack_conf "$1"
|
2016-07-29 01:12:51 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_displaymanager_conf "$1"
|
2016-07-30 17:04:28 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_initcpio_conf "$1"
|
2016-07-30 17:04:28 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_machineid_conf "$1"
|
2016-07-29 01:12:51 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_finished_conf "$1"
|
2016-07-30 17:04:28 +02:00
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_netinstall_conf "$1"
|
2016-07-30 17:04:28 +02:00
|
|
|
|
2016-07-31 23:58:51 +02:00
|
|
|
write_chrootcfg_conf "$1"
|
|
|
|
|
2016-07-30 21:31:07 +02:00
|
|
|
write_services_conf "$1"
|
|
|
|
write_users_conf "$1"
|
2015-01-29 05:12:17 +01:00
|
|
|
}
|