2016-08-21 15:20:29 +02: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-09-18 11:22:58 +02:00
|
|
|
write_machineid_conf(){
|
|
|
|
local conf="${modules_dir}/machineid.conf" switch='false'
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo '---' > "$conf"
|
|
|
|
[[ ${initsys} == 'systemd' ]] && switch='true'
|
|
|
|
echo "systemd: ${switch}" >> $conf
|
|
|
|
echo "dbus: true" >> $conf
|
|
|
|
echo "symlink: true" >> $conf
|
|
|
|
}
|
|
|
|
|
|
|
|
write_finished_conf(){
|
|
|
|
msg2 "Writing %s ..." "finished.conf"
|
2017-03-12 21:04:55 +01:00
|
|
|
local conf="${modules_dir}/finished.conf" cmd="loginctl reboot"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo '---' > "$conf"
|
|
|
|
echo 'restartNowEnabled: true' >> "$conf"
|
|
|
|
echo 'restartNowChecked: false' >> "$conf"
|
2017-03-12 21:04:55 +01:00
|
|
|
[[ ${initsys} == 'systemd' ]] && cmd="systemctl reboot"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo "restartNowCommand: \"${cmd}\"" >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
get_preset(){
|
|
|
|
local p=${tmp_dir}/${kernel}.preset kvmaj kvmin digit
|
|
|
|
cp ${DATADIR}/linux.preset $p
|
|
|
|
digit=${kernel##linux}
|
|
|
|
kvmaj=${digit:0:1}
|
|
|
|
kvmin=${digit:1}
|
|
|
|
|
|
|
|
sed -e "s|@kvmaj@|$kvmaj|g" \
|
|
|
|
-e "s|@kvmin@|$kvmin|g" \
|
|
|
|
-e "s|@arch@|${target_arch}|g"\
|
|
|
|
-i $p
|
|
|
|
echo $p
|
|
|
|
}
|
|
|
|
|
|
|
|
write_bootloader_conf(){
|
2017-06-07 23:45:34 +02:00
|
|
|
local conf="${modules_dir}/bootloader.conf" efi_boot_loader='grub'
|
2016-09-18 11:22:58 +02:00
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
source "$(get_preset)"
|
|
|
|
echo '---' > "$conf"
|
|
|
|
echo "efiBootLoader: \"${efi_boot_loader}\"" >> "$conf"
|
|
|
|
echo "kernel: \"${ALL_kver#*/boot}\"" >> "$conf"
|
|
|
|
echo "img: \"${default_image#*/boot}\"" >> "$conf"
|
|
|
|
echo "fallback: \"${fallback_image#*/boot}\"" >> "$conf"
|
|
|
|
echo 'timeout: "10"' >> "$conf"
|
|
|
|
echo "kernelLine: \", with ${kernel}\"" >> "$conf"
|
|
|
|
echo "fallbackKernelLine: \", with ${kernel} (fallback initramfs)\"" >> "$conf"
|
|
|
|
echo 'grubInstall: "grub-install"' >> "$conf"
|
|
|
|
echo 'grubMkconfig: "grub-mkconfig"' >> "$conf"
|
|
|
|
echo 'grubCfg: "/boot/grub/grub.cfg"' >> "$conf"
|
|
|
|
echo '#efiBootloaderId: "dirname"' >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
write_servicescfg_conf(){
|
2017-06-06 17:58:43 +02:00
|
|
|
local conf="${modules_dir}/servicescfg.conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo '---' > "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo 'services:' >> "$conf"
|
|
|
|
echo ' enabled:' >> "$conf"
|
|
|
|
for s in ${enable_openrc[@]};do
|
|
|
|
echo " - name: $s" >> "$conf"
|
|
|
|
echo ' runlevel: default' >> "$conf"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
write_services_conf(){
|
2017-06-06 17:58:43 +02:00
|
|
|
local conf="${modules_dir}/services.conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo '---' > "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo 'services:' > "$conf"
|
|
|
|
for s in ${enable_systemd[@]};do
|
|
|
|
echo " - name: $s" >> "$conf"
|
|
|
|
echo ' mandatory: false' >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
done
|
|
|
|
echo 'targets:' >> "$conf"
|
|
|
|
echo ' - name: "graphical"' >> "$conf"
|
|
|
|
echo ' mandatory: true' >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
write_displaymanager_conf(){
|
|
|
|
local conf="${modules_dir}/displaymanager.conf"
|
2016-09-27 19:06:50 +02:00
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
2016-09-28 18:44:56 +02:00
|
|
|
echo "displaymanagers:" >> "$conf"
|
|
|
|
echo " - lightdm" >> "$conf"
|
|
|
|
echo " - gdm" >> "$conf"
|
|
|
|
echo " - mdm" >> "$conf"
|
|
|
|
echo " - sddm" >> "$conf"
|
|
|
|
echo " - lxdm" >> "$conf"
|
|
|
|
echo " - slim" >> "$conf"
|
2016-09-27 19:06:50 +02:00
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "basicSetup: false" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_initcpio_conf(){
|
|
|
|
local conf="${modules_dir}/initcpio.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "kernel: ${kernel}" >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
write_unpack_conf(){
|
|
|
|
local conf="${modules_dir}/unpackfs.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "unpack:" >> "$conf"
|
2017-05-21 23:12:31 +02:00
|
|
|
echo " - source: \"/run/miso/bootmnt/${os_id}/${target_arch}/rootfs.sfs\"" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
|
|
|
echo " destination: \"\"" >> "$conf"
|
2017-04-29 22:19:23 +02:00
|
|
|
if [[ -f "${desktop_list}" ]] ; then
|
2017-05-21 23:12:31 +02:00
|
|
|
echo " - source: \"/run/miso/bootmnt/${os_id}/${target_arch}/desktopfs.sfs\"" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo " sourcefs: \"squashfs\"" >> "$conf"
|
|
|
|
echo " destination: \"\"" >> "$conf"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
write_users_conf(){
|
|
|
|
local conf="${modules_dir}/users.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "defaultGroups:" >> "$conf"
|
|
|
|
local IFS=','
|
|
|
|
for g in ${addgroups[@]};do
|
|
|
|
echo " - $g" >> "$conf"
|
|
|
|
done
|
|
|
|
unset IFS
|
2016-11-01 18:49:42 +01:00
|
|
|
echo "autologinGroup: autologin" >> "$conf"
|
2017-01-11 08:40:37 +01:00
|
|
|
echo "doAutologin: false" >> "$conf" # can be either 'true' or 'false'
|
2016-11-01 18:49:42 +01:00
|
|
|
echo "sudoersGroup: wheel" >> "$conf"
|
2017-01-11 08:40:37 +01:00
|
|
|
echo "setRootPassword: true" >> "$conf" # must be true, else some options get hidden
|
|
|
|
echo "doReusePassword: false" >> "$conf" # only used in old 'users' module
|
|
|
|
echo "availableShells: /bin/bash, /bin/zsh" >> "$conf" # only used in new 'users' module
|
2017-01-25 15:42:41 +01:00
|
|
|
echo "avatarFilePath: ~/.face" >> "$conf" # mostly used file-name for avatar
|
2016-09-18 11:22:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_packages_conf(){
|
|
|
|
local conf="${modules_dir}/packages.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "backend: pacman" >> "$conf"
|
2017-02-03 15:20:43 +01:00
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "update_db: true" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_welcome_conf(){
|
|
|
|
local conf="${modules_dir}/welcome.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf" >> "$conf"
|
|
|
|
echo "showSupportUrl: true" >> "$conf"
|
|
|
|
echo "showKnownIssuesUrl: true" >> "$conf"
|
|
|
|
echo "showReleaseNotesUrl: true" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "requirements:" >> "$conf"
|
2016-11-23 19:44:31 +01:00
|
|
|
echo " requiredStorage: 7.9" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo " requiredRam: 1.0" >> "$conf"
|
2017-02-03 20:29:44 +01:00
|
|
|
echo " internetCheckUrl: https://manjaro.org" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo " check:" >> "$conf"
|
|
|
|
echo " - storage" >> "$conf"
|
|
|
|
echo " - ram" >> "$conf"
|
|
|
|
echo " - power" >> "$conf"
|
|
|
|
echo " - internet" >> "$conf"
|
|
|
|
echo " - root" >> "$conf"
|
|
|
|
echo " required:" >> "$conf"
|
|
|
|
echo " - storage" >> "$conf"
|
|
|
|
echo " - ram" >> "$conf"
|
|
|
|
echo " - root" >> "$conf"
|
|
|
|
if ${netinstall};then
|
|
|
|
echo " - internet" >> "$conf"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
write_mhwdcfg_conf(){
|
|
|
|
local conf="${modules_dir}/mhwdcfg.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "bus:" >> "$conf"
|
|
|
|
echo " - pci" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "identifier:" >> "$conf"
|
|
|
|
echo " net:" >> "$conf"
|
|
|
|
echo " - 200" >> "$conf"
|
|
|
|
echo " - 280" >> "$conf"
|
|
|
|
echo " video:" >> "$conf"
|
|
|
|
echo " - 300" >> "$conf"
|
|
|
|
echo " - 302" >> "$conf"
|
|
|
|
echo " - 380" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
2016-09-28 20:24:52 +02:00
|
|
|
local drv="free"
|
|
|
|
${nonfree_mhwd} && drv="nonfree"
|
|
|
|
echo "driver: ${drv}" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo '' >> "$conf"
|
2017-05-15 10:57:20 +02:00
|
|
|
echo "local: ${netinstall}" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo '' >> "$conf"
|
|
|
|
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
write_postcfg_conf(){
|
|
|
|
local conf="${modules_dir}/postcfg.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "keyrings:" >> "$conf"
|
|
|
|
echo " - archlinux" >> "$conf"
|
|
|
|
echo " - manjaro" >> "$conf"
|
|
|
|
}
|
|
|
|
|
2017-05-07 22:08:33 +02:00
|
|
|
write_umount_conf(){
|
|
|
|
local conf="${modules_dir}/umount.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo 'srcLog: "/root/.cache/Calamares/Calamares/Calamares.log"' >> "$conf"
|
|
|
|
echo 'destLog: "/var/log/Calamares.log"' >> "$conf"
|
|
|
|
}
|
|
|
|
|
2016-09-18 11:22:58 +02:00
|
|
|
get_yaml(){
|
2016-11-01 11:16:22 +01:00
|
|
|
local args=() yaml
|
2016-09-28 14:24:06 +02:00
|
|
|
if ${chrootcfg};then
|
2017-02-19 16:24:34 +01:00
|
|
|
args+=("${profile}/chrootcfg")
|
2016-09-28 14:24:06 +02:00
|
|
|
else
|
2017-02-19 16:24:34 +01:00
|
|
|
args+=("${profile}/packages")
|
2016-09-18 11:22:58 +02:00
|
|
|
fi
|
|
|
|
args+=("${initsys}")
|
|
|
|
for arg in ${args[@]};do
|
|
|
|
yaml=${yaml:-}${yaml:+-}${arg}
|
|
|
|
done
|
2016-11-01 11:16:22 +01:00
|
|
|
echo "${yaml}.yaml"
|
2016-09-18 11:22:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_netinstall_conf(){
|
|
|
|
local conf="${modules_dir}/netinstall.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "groupsUrl: ${netgroups}/$(get_yaml)" >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
write_locale_conf(){
|
|
|
|
local conf="${modules_dir}/locale.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "localeGenPath: /etc/locale.gen" >> "$conf"
|
2017-06-07 23:45:34 +02:00
|
|
|
echo "geoipUrl: freegeoip.net" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_settings_conf(){
|
|
|
|
local conf="$1/etc/calamares/settings.conf"
|
|
|
|
msg2 "Writing %s ..." "${conf##*/}"
|
|
|
|
echo "---" > "$conf"
|
|
|
|
echo "modules-search: [ local ]" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "sequence:" >> "$conf"
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - show:" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - welcome" >> "$conf" && write_welcome_conf
|
|
|
|
echo " - locale" >> "$conf" && write_locale_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - keyboard" >> "$conf"
|
|
|
|
echo " - partition" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - users" >> "$conf" && write_users_conf
|
|
|
|
if ${netinstall};then
|
|
|
|
echo " - netinstall" >> "$conf" && write_netinstall_conf
|
|
|
|
fi
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - summary" >> "$conf"
|
|
|
|
echo " - exec:" >> "$conf"
|
|
|
|
echo " - partition" >> "$conf"
|
|
|
|
echo " - mount" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
if ${netinstall};then
|
2016-09-28 14:24:06 +02:00
|
|
|
if ${chrootcfg}; then
|
|
|
|
echo " - chrootcfg" >> "$conf"
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - networkcfg" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
else
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - unpackfs" >> "$conf" && write_unpack_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - networkcfg" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - packages" >> "$conf" && write_packages_conf
|
2016-09-28 14:30:33 +02:00
|
|
|
fi
|
2016-09-18 11:22:58 +02:00
|
|
|
else
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - unpackfs" >> "$conf" && write_unpack_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - networkcfg" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
fi
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - machineid" >> "$conf" && write_machineid_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - fstab" >> "$conf"
|
|
|
|
echo " - locale" >> "$conf"
|
|
|
|
echo " - keyboard" >> "$conf"
|
|
|
|
echo " - localecfg" >> "$conf"
|
|
|
|
echo " - luksopenswaphookcfg" >> "$conf"
|
|
|
|
echo " - luksbootkeyfile" >> "$conf"
|
|
|
|
echo " - initcpiocfg" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - initcpio" >> "$conf" && write_initcpio_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - users" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - displaymanager" >> "$conf" && write_displaymanager_conf
|
|
|
|
echo " - mhwdcfg" >> "$conf" && write_mhwdcfg_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - hwclock" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
case ${initsys} in
|
2016-09-29 00:15:50 +02:00
|
|
|
'systemd') echo " - services" >> "$conf" && write_services_conf ;;
|
|
|
|
'openrc') echo " - servicescfg" >> "$conf" && write_servicescfg_conf ;;
|
2016-09-18 11:22:58 +02:00
|
|
|
esac
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - grubcfg" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - bootloader" >> "$conf" && write_bootloader_conf
|
|
|
|
echo " - postcfg" >> "$conf" && write_postcfg_conf
|
2017-05-07 22:08:33 +02:00
|
|
|
echo " - umount" >> "$conf" && write_umount_conf
|
2016-09-19 08:33:27 +02:00
|
|
|
echo " - show:" >> "$conf"
|
2016-09-29 00:15:50 +02:00
|
|
|
echo " - finished" >> "$conf" && write_finished_conf
|
2016-09-18 11:22:58 +02:00
|
|
|
echo '' >> "$conf"
|
2017-05-21 23:12:31 +02:00
|
|
|
echo "branding: ${os_id}" >> "$conf"
|
2016-09-18 11:22:58 +02:00
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "prompt-install: false" >> "$conf"
|
|
|
|
echo '' >> "$conf"
|
|
|
|
echo "dont-chroot: false" >> "$conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
configure_calamares(){
|
|
|
|
info "Configuring [Calamares]"
|
|
|
|
modules_dir=$1/etc/calamares/modules
|
2016-09-29 00:15:50 +02:00
|
|
|
prepare_dir "${modules_dir}"
|
2016-09-18 11:22:58 +02:00
|
|
|
write_settings_conf "$1"
|
|
|
|
info "Done configuring [Calamares]"
|
|
|
|
}
|