forked from mirrored-repos/manjaro-tools
Merge branch 'master' into stable-0.13.x
This commit is contained in:
commit
3a37521eed
8 changed files with 212 additions and 346 deletions
|
@ -26,7 +26,6 @@ show_profile(){
|
|||
msg2 "work_dir: %s" "${work_dir}"
|
||||
msg2 "iso_dir: %s" "${iso_dir}"
|
||||
msg2 "iso_file: %s" "${iso_file}"
|
||||
msg2 "displaymanager: %s" "${displaymanager}"
|
||||
msg2 "autologin: %s" "${autologin}"
|
||||
msg2 "nonfree_xorg: %s" "${nonfree_xorg}"
|
||||
msg2 "pxe_boot: %s" "${pxe_boot}"
|
||||
|
@ -39,7 +38,6 @@ show_profile(){
|
|||
msg2 "cal_unpackfs: %s" "${cal_unpackfs}"
|
||||
|
||||
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
|
||||
msg2 "efi_part_size: %s" "${efi_part_size}"
|
||||
|
||||
msg2 "hostname: %s" "${hostname}"
|
||||
msg2 "username: %s" "${username}"
|
||||
|
@ -48,13 +46,13 @@ show_profile(){
|
|||
msg2 "addgroups: %s" "${addgroups}"
|
||||
|
||||
if [[ ${initsys} == 'systemd' ]];then
|
||||
msg2 "start_systemd: %s" "${start_systemd[*]}"
|
||||
msg2 "start_systemd_live: %s" "${start_systemd_live[*]}"
|
||||
msg2 "disable_systemd: %s" "${disable_systemd[*]}"
|
||||
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
|
||||
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
|
||||
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
|
||||
else
|
||||
msg2 "start_openrc: %s" "${start_openrc[*]}"
|
||||
msg2 "start_openrc_live: %s" "${start_openrc_live[*]}"
|
||||
msg2 "disable_openrc: %s" "${disable_openrc[*]}"
|
||||
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
|
||||
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
|
||||
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
|
||||
fi
|
||||
if ${torrent};then
|
||||
msg2 "tracker_url: %s" "${tracker_url}"
|
||||
|
|
|
@ -34,14 +34,11 @@
|
|||
# possible values: grub;systemd-boot
|
||||
# efi_boot_loader="grub"
|
||||
|
||||
# set uefi partition size
|
||||
# efi_part_size=31M
|
||||
|
||||
# configure calamares for netinstall
|
||||
# cal_netinstall="false"
|
||||
|
||||
# the default url for the netinstall.yaml
|
||||
# cal_netgroups="https://raw.githubusercontent.com/calamares/calamares-manjaro/master/netinstall.yaml"
|
||||
# cal_netgroups="https://raw.githubusercontent.com/calamares/calamares-manjaro/master"
|
||||
|
||||
# configure calamares to use chrootcfg instead of unpackfs
|
||||
# cal_unpackfs="true"
|
||||
|
@ -51,35 +48,37 @@
|
|||
|
||||
# unset defaults to given values
|
||||
# names must match systemd service names
|
||||
# start_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
||||
# enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
||||
# disable_systemd=()
|
||||
|
||||
# unset defaults to given values,
|
||||
# names must match openrc service names
|
||||
# start_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
|
||||
################# live-session #################
|
||||
# enable_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
# disable_openrc=()
|
||||
|
||||
# unset defaults to given value
|
||||
# hostname="manjaro"
|
||||
|
||||
# unset defaults to given value
|
||||
# username="manjaro"
|
||||
|
||||
# unset defaults to given value
|
||||
# password="manjaro"
|
||||
|
||||
# the login shell
|
||||
# login_shell=/bin/bash
|
||||
|
||||
# unset defaults to given values
|
||||
# addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
|
||||
|
||||
################# live-session #################
|
||||
|
||||
# unset defaults to given value
|
||||
# username="manjaro"
|
||||
|
||||
# unset defaults to given value
|
||||
# password="manjaro"
|
||||
|
||||
# unset defaults to given values
|
||||
# names must match systemd service names
|
||||
# services in start_systemd array don't need to be listed here
|
||||
# start_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init')
|
||||
# services in enable_systemd array don't need to be listed here
|
||||
# enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
|
||||
|
||||
# unset defaults to given values,
|
||||
# names must match openrc service names
|
||||
# services in start_openrc array don't need to be listed here
|
||||
# start_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init')
|
||||
# services in enable_openrc array don't need to be listed here
|
||||
# enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init' 'mirrors-live')
|
||||
|
|
|
@ -266,8 +266,8 @@
|
|||
<listitem><para>Takes <option>systemd</option> (the default)
|
||||
or <option>openrc</option>. Selecting and option will change
|
||||
how the hostname, the displaymanager and services will be configured.
|
||||
For services also controls if buildiso will use start_systemd and
|
||||
start_systemd_live or start_openrc and start_openrc_live to determine
|
||||
For services also controls if buildiso will use enable_systemd and
|
||||
enable_systemd_live or enable_openrc and enable_openrc_live to determine
|
||||
the default services that will be enabled automatically.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -164,16 +164,6 @@
|
|||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>efi_part_size=</varname></term>
|
||||
|
||||
<listitem><para>Size in MiB of the fat partition where
|
||||
the kernel is. This is useful if you add extra hooks
|
||||
in the mkinitcpio.conf and it's to big to fit in the
|
||||
partition. The default is "32M".
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>plymouth_theme=</varname></term>
|
||||
|
||||
|
@ -184,7 +174,7 @@
|
|||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>start_systemd=</varname></term>
|
||||
<term><varname>enable_systemd=</varname></term>
|
||||
|
||||
<listitem><para>Array of services that will be
|
||||
enabled in systemd systems. It has to match
|
||||
|
@ -193,7 +183,7 @@
|
|||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>start_openrc=</varname></term>
|
||||
<term><varname>enable_openrc=</varname></term>
|
||||
|
||||
<listitem><para>Array of services that will be
|
||||
enabled in openrc systems.
|
||||
|
@ -241,7 +231,7 @@
|
|||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>start_systemd_live=</varname></term>
|
||||
<term><varname>enable_systemd_live=</varname></term>
|
||||
|
||||
<listitem><para>Array of services that will be
|
||||
enabled in the systemd live-cd. It has to match
|
||||
|
@ -250,7 +240,7 @@
|
|||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>start_openrc_live=</varname></term>
|
||||
<term><varname>enable_openrc_live=</varname></term>
|
||||
|
||||
<listitem><para>Array of services that will be
|
||||
enabled in the openrc live-cd.
|
||||
|
|
|
@ -52,29 +52,30 @@ write_bootloader_conf(){
|
|||
}
|
||||
|
||||
write_services_conf(){
|
||||
if [[ ${initsys} == 'openrc' ]];then
|
||||
local conf="$1/etc/calamares/modules/servicescfg.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
|
||||
if [[ -n ${disable_openrc[@]} ]];then
|
||||
echo ' disabled:' >> "$conf"
|
||||
for s in ${disable_openrc[@]};do
|
||||
echo " - name: $s" >> "$conf"
|
||||
echo ' runlevel: default' >> "$conf"
|
||||
echo '' >> "$conf"
|
||||
done
|
||||
fi
|
||||
else
|
||||
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"
|
||||
echo '' >> "$conf"
|
||||
echo 'disable:' >> "$conf"
|
||||
for s in ${disable_openrc[@]};do
|
||||
echo ' - name: '"$s" >> "$conf"
|
||||
echo ' mandatory: false' >> "$conf"
|
||||
echo '' >> "$conf"
|
||||
done
|
||||
else
|
||||
echo 'services:' > "$conf"
|
||||
for s in ${start_systemd[@]};do
|
||||
for s in ${enable_systemd[@]};do
|
||||
echo ' - name: '"$s" >> "$conf"
|
||||
echo ' mandatory: false' >> "$conf"
|
||||
echo '' >> "$conf"
|
||||
|
@ -119,7 +120,7 @@ write_unpack_conf(){
|
|||
echo " - source: \"/bootmnt/${iso_name}/${target_arch}/root-image.sqfs\"" >> "$conf"
|
||||
echo " sourcefs: \"squashfs\"" >> "$conf"
|
||||
echo " destination: \"\"" >> "$conf"
|
||||
if [[ -f /bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs ]];then
|
||||
if ! ${cal_netinstall};then
|
||||
echo " - source: \"/bootmnt/${iso_name}/${target_arch}/${profile}-image.sqfs\"" >> "$conf"
|
||||
echo " sourcefs: \"squashfs\"" >> "$conf"
|
||||
echo " destination: \"\"" >> "$conf"
|
||||
|
@ -167,7 +168,9 @@ write_welcome_conf(){
|
|||
echo " - storage" >> "$conf"
|
||||
echo " - ram" >> "$conf"
|
||||
echo " - root" >> "$conf"
|
||||
${cal_netinstall} && echo " - internet" >> "$conf"
|
||||
if ${cal_netinstall};then
|
||||
echo " - internet" >> "$conf"
|
||||
fi
|
||||
}
|
||||
|
||||
write_settings_conf(){
|
||||
|
@ -195,8 +198,6 @@ write_settings_conf(){
|
|||
echo " - networkcfg" >> "$conf"
|
||||
echo " - packages" >> "$conf"
|
||||
else
|
||||
# take out networkcfg once a new PR has been merged
|
||||
echo " - networkcfg" >> "$conf"
|
||||
echo " - chrootcfg" >> "$conf"
|
||||
fi
|
||||
else
|
||||
|
@ -214,10 +215,14 @@ write_settings_conf(){
|
|||
echo " - initcpio" >> "$conf"
|
||||
echo " - users" >> "$conf"
|
||||
echo " - displaymanager" >> "$conf"
|
||||
echo " - hardwarecfg" >> "$conf"
|
||||
echo " - mhwdcfg" >> "$conf"
|
||||
echo " - networkcfg" >> "$conf"
|
||||
echo " - hwclock" >> "$conf"
|
||||
if [[ ${initsys} == 'systemd' ]];then
|
||||
echo " - services" >> "$conf"
|
||||
else
|
||||
echo " - servicescfg" >> "$conf"
|
||||
fi
|
||||
echo " - grubcfg" >> "$conf"
|
||||
echo " - bootloader" >> "$conf"
|
||||
echo " - postcfg" >> "$conf"
|
||||
|
@ -232,22 +237,53 @@ write_settings_conf(){
|
|||
echo "dont-chroot: false" >> "$conf"
|
||||
}
|
||||
|
||||
write_mhwdcfg_conf(){
|
||||
local conf="$1/etc/calamares/modules/mhwdcfg.conf"
|
||||
echo "---" > "$conf"
|
||||
echo "bus_types:" >> "$conf"
|
||||
echo " - pci" >> "$conf"
|
||||
echo " - usb" >> "$conf"
|
||||
echo '' >> "$conf"
|
||||
echo "identifiers:" >> "$conf"
|
||||
echo " net:" >> "$conf"
|
||||
echo " - '0200'" >> "$conf"
|
||||
echo " - '0280'" >> "$conf"
|
||||
echo " vid:" >> "$conf"
|
||||
echo " - '0300'" >> "$conf"
|
||||
echo '' >> "$conf"
|
||||
if ${cal_netinstall};then
|
||||
if ${cal_unpackfs};then
|
||||
echo "local_repo: true" >> "$conf"
|
||||
else
|
||||
echo "local_repo: false" >> "$conf"
|
||||
fi
|
||||
else
|
||||
echo "local_repo: true" >> "$conf"
|
||||
fi
|
||||
echo '' >> "$conf"
|
||||
echo "repo_conf: /opt/live/pacman-gfx.conf" >> "$conf"
|
||||
}
|
||||
|
||||
write_chrootcfg_conf(){
|
||||
local conf="$1/etc/calamares/modules/chrootcfg.conf"
|
||||
local conf="$1/etc/calamares/modules/chrootcfg.conf" mode='"0o755"'
|
||||
echo "---" > "$conf"
|
||||
echo "directories:" >> "$conf"
|
||||
echo " - name: /etc" >> "$conf"
|
||||
echo " mode: 755" >> "$conf"
|
||||
echo " mode: ${mode}" >> "$conf"
|
||||
echo " - name: /var/log" >> "$conf"
|
||||
echo " mode: 755" >> "$conf"
|
||||
echo " mode: ${mode}" >> "$conf"
|
||||
echo " - name: /var/cache/pacman/pkg" >> "$conf"
|
||||
echo " mode: 755" >> "$conf"
|
||||
echo " mode: ${mode}" >> "$conf"
|
||||
echo " - name: /var/lib/pacman" >> "$conf"
|
||||
echo " mode: 755" >> "$conf"
|
||||
echo " mode: ${mode}" >> "$conf"
|
||||
echo '' >> "$conf"
|
||||
echo "requirements:" >> "$conf"
|
||||
echo " - pacman" >> "$conf"
|
||||
echo " - ${kernel}" >> "$conf"
|
||||
if [[ ${initsys} == 'openrc' ]]; then
|
||||
echo " - eudev-systemdcompat" >> "$conf"
|
||||
echo " - udev-openrc" >> "$conf"
|
||||
fi
|
||||
echo '' >> "$conf"
|
||||
echo "keyrings:" >> "$conf"
|
||||
echo " - archlinux" >> "$conf"
|
||||
|
@ -258,8 +294,10 @@ write_chrootcfg_conf(){
|
|||
|
||||
write_netinstall_conf(){
|
||||
local conf="$1/etc/calamares/modules/netinstall.conf"
|
||||
local yaml="netinstall.yaml"
|
||||
[[ ${initsys} == 'openrc' ]] && yaml="netinstall-${initsys}.yaml"
|
||||
echo "---" > "$conf"
|
||||
echo "groupsUrl: ${cal_netgroups}" >> "$conf"
|
||||
echo "groupsUrl: ${cal_netgroups}/${yaml}" >> "$conf"
|
||||
}
|
||||
|
||||
configure_calamares(){
|
||||
|
@ -275,6 +313,8 @@ configure_calamares(){
|
|||
|
||||
write_bootloader_conf "$1"
|
||||
|
||||
write_mhwdcfg_conf "$1"
|
||||
|
||||
write_unpack_conf "$1"
|
||||
|
||||
write_displaymanager_conf "$1"
|
||||
|
|
|
@ -18,26 +18,6 @@ copy_overlay(){
|
|||
fi
|
||||
}
|
||||
|
||||
gen_pw(){
|
||||
echo $(perl -e 'print crypt($ARGV[0], "password")' ${password})
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
configure_user(){
|
||||
# set up user and password
|
||||
msg2 "Creating user ..."
|
||||
if [[ -n ${password} ]];then
|
||||
chroot $1 useradd -m -G ${addgroups} -p $(gen_pw) -s ${login_shell} ${username}
|
||||
else
|
||||
chroot $1 useradd -m -G ${addgroups} -s ${login_shell} ${username}
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
configure_hosts(){
|
||||
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
|
||||
}
|
||||
|
||||
configure_plymouth(){
|
||||
if ${plymouth_boot};then
|
||||
msg2 "Configuring plymouth: %s" "${plymouth_theme}"
|
||||
|
@ -60,60 +40,6 @@ add_svc_sd(){
|
|||
chroot $1 systemctl enable $2 &>/dev/null
|
||||
fi
|
||||
}
|
||||
# $1: chroot
|
||||
configure_environment(){
|
||||
case ${profile} in
|
||||
cinnamon*|deepin*|gnome|i3|lxde|mate|netbook|openbox|pantheon|xfce*)
|
||||
echo "QT_STYLE_OVERRIDE=gtk" >> $1/etc/environment
|
||||
if [[ -f "$1/usr/lib/qt/plugins/platformthemes/libqt5ct.so" ]];then
|
||||
sed -i '/QT_STYLE_OVERRIDE=gtk/d' $1/etc/environment
|
||||
echo "QT_QPA_PLATFORMTHEME=qt5ct" >> $1/etc/environment
|
||||
fi
|
||||
if [[ -f "$1/usr/lib/qt/plugins/styles/libqgtk2style.so" ]];then
|
||||
sed -i '/QT_STYLE_OVERRIDE=gtk/d' $1/etc/environment
|
||||
echo "QT_STYLE_OVERRIDE=gtk2" >> $1/etc/environment
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
# $2: user
|
||||
configure_accountsservice(){
|
||||
msg2 "Configuring accountsservice ..."
|
||||
local path=$1/var/lib/AccountsService/users
|
||||
if [ -d "${path}" ] ; then
|
||||
echo "[User]" > ${path}/$2
|
||||
echo "XSession=${default_desktop_file}" >> ${path}/$2
|
||||
if [[ -f "/var/lib/AccountsService/icons/$2.png" ]];then
|
||||
echo "Icon=/var/lib/AccountsService/icons/$2.png" >> ${path}/$2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
load_desktop_map(){
|
||||
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g" \
|
||||
file=${DATADIR}/desktop.map
|
||||
local desktop_map=$(sed "$_com_rm" "$file" \
|
||||
| sed "$_space" \
|
||||
| sed "$_clean")
|
||||
echo ${desktop_map}
|
||||
}
|
||||
|
||||
detect_desktop_env(){
|
||||
local xs=$1/usr/share/xsessions ex=$1/usr/bin key val map=( $(load_desktop_map) )
|
||||
default_desktop_file="none"
|
||||
default_desktop_executable="none"
|
||||
for item in "${map[@]}";do
|
||||
key=${item%:*}
|
||||
val=${item#*:}
|
||||
if [[ -f $xs/$key.desktop ]] && [[ -f $ex/$val ]];then
|
||||
default_desktop_file="$key"
|
||||
default_desktop_executable="$val"
|
||||
fi
|
||||
done
|
||||
msg2 "Detected desktop environment: %s" "${default_desktop_file}"
|
||||
}
|
||||
|
||||
set_xdm(){
|
||||
if [[ -f $1/etc/conf.d/xdm ]];then
|
||||
|
@ -122,79 +48,6 @@ set_xdm(){
|
|||
fi
|
||||
}
|
||||
|
||||
is_valid_de(){
|
||||
if [[ ${default_desktop_executable} != "none" ]] && \
|
||||
[[ ${default_desktop_file} != "none" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
set_sddm_ck(){
|
||||
local halt='/usr/bin/shutdown -h -P now' \
|
||||
reboot='/usr/bin/shutdown -r now'
|
||||
sed -e "s|^.*HaltCommand=.*|HaltCommand=${halt}|" \
|
||||
-e "s|^.*RebootCommand=.*|RebootCommand=${reboot}|" \
|
||||
-e "s|^.*MinimumVT=.*|MinimumVT=7|" \
|
||||
-i "$1/etc/sddm.conf"
|
||||
chroot $1 gpasswd -a sddm video &> /dev/null
|
||||
}
|
||||
|
||||
set_lightdm_greeter(){
|
||||
local greeters=$(ls $1/usr/share/xgreeters/*greeter.desktop) name
|
||||
for g in ${greeters[@]};do
|
||||
name=${g##*/}
|
||||
name=${name%%.*}
|
||||
case ${name} in
|
||||
'lightdm-deepin-greeter'|'lightdm-kde-greeter')
|
||||
sed -i -e "s/^.*greeter-session=.*/greeter-session=${name}/" $1/etc/lightdm/lightdm.conf
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
set_lightdm_ck(){
|
||||
sed -i -e 's/^.*minimum-vt=.*/minimum-vt=7/' $1/etc/lightdm/lightdm.conf
|
||||
sed -i -e 's/pam_systemd.so/pam_ck_connector.so nox11/' $1/etc/pam.d/lightdm-greeter
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
configure_displaymanager(){
|
||||
msg2 "Configuring Displaymanager ..."
|
||||
# Try to detect desktop environment
|
||||
detect_desktop_env "$1"
|
||||
# Configure display manager
|
||||
case ${displaymanager} in
|
||||
'lightdm')
|
||||
chroot $1 groupadd -r autologin
|
||||
[[ ${initsys} == 'openrc' ]] && set_lightdm_ck "$1"
|
||||
set_lightdm_greeter "$1"
|
||||
if $(is_valid_de); then
|
||||
sed -i -e "s/^.*user-session=.*/user-session=$default_desktop_file/" $1/etc/lightdm/lightdm.conf
|
||||
fi
|
||||
;;
|
||||
'gdm') configure_accountsservice "$1" "gdm" ;;
|
||||
'mdm')
|
||||
if $(is_valid_de); then
|
||||
sed -i "s|default.desktop|$default_desktop_file.desktop|g" $1/etc/mdm/custom.conf
|
||||
fi
|
||||
;;
|
||||
'sddm')
|
||||
[[ ${initsys} == 'openrc' ]] && set_sddm_ck "$1"
|
||||
if $(is_valid_de); then
|
||||
sed -i -e "s|^Session=.*|Session=$default_desktop_file.desktop|" $1/etc/sddm.conf
|
||||
fi
|
||||
;;
|
||||
'lxdm')
|
||||
if $(is_valid_de); then
|
||||
sed -i -e "s|^.*session=.*|session=/usr/bin/$default_desktop_executable|" $1/etc/lxdm/lxdm.conf
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
msg2 "Configured: ${displaymanager}"
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
configure_mhwd_drivers(){
|
||||
local path=$1/opt/live/pkgs/ \
|
||||
|
@ -248,13 +101,6 @@ chroot_clean(){
|
|||
rm -rf --one-file-system "$1"
|
||||
}
|
||||
|
||||
# Remove pamac auto-update when the network is up, it locks de pacman db when booting in the livecd
|
||||
# $1: chroot
|
||||
configure_pamac_live() {
|
||||
if [[ -f $1/etc/NetworkManager/dispatcher.d/99_update_pamac_tray ]];then
|
||||
rm -f $1/etc/NetworkManager/dispatcher.d/99_update_pamac_tray
|
||||
fi
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
configure_lsb(){
|
||||
|
@ -280,11 +126,6 @@ configure_logind(){
|
|||
local conf=$1/etc/systemd/logind.conf
|
||||
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
|
||||
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
|
||||
}
|
||||
|
||||
configure_logind_live(){
|
||||
msg2 "Configuring logind ..."
|
||||
local conf=$1/etc/systemd/logind.conf
|
||||
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
|
||||
}
|
||||
|
||||
|
@ -294,65 +135,23 @@ configure_journald(){
|
|||
sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf"
|
||||
}
|
||||
|
||||
configure_sysctl(){
|
||||
msg2 "Configuring sysctl ..."
|
||||
touch $1/etc/sysctl.conf
|
||||
local conf=$1/etc/sysctl.d/100-manjaro.conf
|
||||
# echo '# Virtual memory setting (swap file or partition)' > ${conf}
|
||||
# echo 'vm.swappiness = 30' >> ${conf}
|
||||
echo '# Enable the SysRq key' >> ${conf}
|
||||
echo 'kernel.sysrq = 1' >> ${conf}
|
||||
}
|
||||
|
||||
get_svc_dm(){
|
||||
local service=${displaymanager}
|
||||
if [[ $service != "sddm" ]] || \
|
||||
[[ $service != "lxdm" ]];then
|
||||
if ${plymouth_boot}; then
|
||||
local svc="systemd/system/$service-plymouth.service"
|
||||
if [[ -f $1/etc/$svc ]] || \
|
||||
[[ -f $1/usr/lib/$svc ]];then
|
||||
service="$service-plymouth"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo $service
|
||||
}
|
||||
|
||||
configure_services(){
|
||||
info "Configuring [%s]" "${initsys}"
|
||||
case ${initsys} in
|
||||
'openrc')
|
||||
for svc in ${start_openrc[@]}; do
|
||||
for svc in ${enable_openrc[@]}; do
|
||||
[[ $svc == "xdm" ]] && set_xdm "$1"
|
||||
add_svc_rc "$1" "$svc"
|
||||
done
|
||||
for svc in ${enable_openrc_live[@]}; do
|
||||
add_svc_rc "$1" "$svc"
|
||||
done
|
||||
if [[ ${displaymanager} != "none" ]];then
|
||||
set_xdm "$1"
|
||||
add_svc_rc "$1" "xdm"
|
||||
fi
|
||||
;;
|
||||
'systemd')
|
||||
for svc in ${start_systemd[@]}; do
|
||||
for svc in ${enable_systemd[@]}; do
|
||||
add_svc_sd "$1" "$svc"
|
||||
done
|
||||
if [[ ${displaymanager} != "none" ]];then
|
||||
add_svc_sd "$1" "$(get_svc_dm $1)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
info "Done configuring [%s]" "${initsys}"
|
||||
}
|
||||
|
||||
configure_services_live(){
|
||||
info "Configuring [%s]" "${initsys}"
|
||||
case ${initsys} in
|
||||
'openrc')
|
||||
for svc in ${start_openrc_live[@]}; do
|
||||
add_svc_rc "$1" "$svc"
|
||||
done
|
||||
;;
|
||||
'systemd')
|
||||
for svc in ${start_systemd_live[@]}; do
|
||||
for svc in ${enable_systemd_live[@]}; do
|
||||
add_svc_sd "$1" "$svc"
|
||||
done
|
||||
;;
|
||||
|
@ -360,30 +159,36 @@ configure_services_live(){
|
|||
info "Done configuring [%s]" "${initsys}"
|
||||
}
|
||||
|
||||
configure_root_image(){
|
||||
msg "Configuring [root-image]"
|
||||
configure_lsb "$1"
|
||||
configure_mhwd "$1"
|
||||
|
||||
case ${initsys} in
|
||||
'systemd')
|
||||
configure_logind "$1"
|
||||
;;
|
||||
'openrc')
|
||||
configure_sysctl "$1"
|
||||
rm $1/etc/runlevels/boot/hwclock
|
||||
;;
|
||||
esac
|
||||
msg "Done configuring [root-image]"
|
||||
is_valid_de(){
|
||||
if [[ ${default_desktop_executable} != "none" ]] && \
|
||||
[[ ${default_desktop_file} != "none" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
configure_custom_image(){
|
||||
msg "Configuring [%s-image]" "${profile}"
|
||||
configure_plymouth "$1"
|
||||
[[ ${displaymanager} != 'none' ]] && configure_displaymanager "$1"
|
||||
configure_services "$1"
|
||||
configure_environment "$1"
|
||||
msg "Done configuring [%s-image]" "${profile}"
|
||||
load_desktop_map(){
|
||||
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g" \
|
||||
file=${DATADIR}/desktop.map
|
||||
local desktop_map=$(sed "$_com_rm" "$file" \
|
||||
| sed "$_space" \
|
||||
| sed "$_clean")
|
||||
echo ${desktop_map}
|
||||
}
|
||||
|
||||
detect_desktop_env(){
|
||||
local xs=$1/usr/share/xsessions ex=$1/usr/bin key val map=( $(load_desktop_map) )
|
||||
default_desktop_file="none"
|
||||
default_desktop_executable="none"
|
||||
for item in "${map[@]}";do
|
||||
key=${item%:*}
|
||||
val=${item#*:}
|
||||
if [[ -f $xs/$key.desktop ]] && [[ -f $ex/$val ]];then
|
||||
default_desktop_file="$key"
|
||||
default_desktop_executable="$val"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
write_live_session_conf(){
|
||||
|
@ -396,41 +201,63 @@ write_live_session_conf(){
|
|||
echo '# autologin' >> ${conf}
|
||||
echo "autologin=${autologin}" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# login shell' >> ${conf}
|
||||
echo "login_shell=${login_shell}" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# live username' >> ${conf}
|
||||
echo "username=${username}" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# live password' >> ${conf}
|
||||
echo "password=${password}" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# live group membership' >> ${conf}
|
||||
echo "addgroups='${addgroups}'" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# iso name' >> ${conf}
|
||||
echo "iso_name=${iso_name}" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# default_desktop_file' >> ${conf}
|
||||
echo "default_desktop_file=${default_desktop_file}" >> ${conf}
|
||||
echo '' >> ${conf}
|
||||
echo '# default_desktop_executable' >> ${conf}
|
||||
echo "default_desktop_executable=${default_desktop_executable}" >> ${conf}
|
||||
}
|
||||
|
||||
configure_live_image(){
|
||||
msg "Configuring [live-image]"
|
||||
configure_hosts "$1"
|
||||
configure_user "$1"
|
||||
configure_accountsservice "$1" "${username}"
|
||||
configure_pamac_live "$1"
|
||||
configure_hosts(){
|
||||
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
|
||||
}
|
||||
|
||||
configure_system(){
|
||||
case ${initsys} in
|
||||
'systemd')
|
||||
configure_logind_live "$1"
|
||||
configure_journald "$1"
|
||||
configure_logind "$1"
|
||||
|
||||
# Prevent some services to be started in the livecd
|
||||
echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \
|
||||
| tee "${path}/etc/.updated" >"${path}/var/.updated"
|
||||
|
||||
msg2 "Configuring hostname ..."
|
||||
echo ${hostname} > $1/etc/hostname
|
||||
|
||||
msg2 "Disable systemd-gpt-auto-generator"
|
||||
ln -sf /dev/null "${path}/usr/lib/systemd/system-generators/systemd-gpt-auto-generator"
|
||||
|
||||
echo ${hostname} > $1/etc/hostname
|
||||
;;
|
||||
'openrc')
|
||||
msg2 "Configuring hostname ..."
|
||||
local _hostname='hostname="'${hostname}'"'
|
||||
sed -i -e "s|^.*hostname=.*|${_hostname}|" $1/etc/conf.d/hostname
|
||||
local hn='hostname="'${hostname}'"'
|
||||
sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname
|
||||
;;
|
||||
esac
|
||||
configure_services_live "$1"
|
||||
}
|
||||
|
||||
configure_live_image(){
|
||||
msg "Configuring [live-image]"
|
||||
detect_desktop_env "$1"
|
||||
configure_hosts "$1"
|
||||
configure_plymouth "$1"
|
||||
configure_lsb "$1"
|
||||
configure_mhwd "$1"
|
||||
configure_system "$1"
|
||||
configure_services "$1"
|
||||
configure_calamares "$1"
|
||||
write_live_session_conf "$1"
|
||||
msg "Done configuring [live-image]"
|
||||
|
|
|
@ -170,20 +170,23 @@ make_iso() {
|
|||
|
||||
# $1: file
|
||||
make_checksum(){
|
||||
cd ${iso_dir}
|
||||
msg "Creating [%s] sum ..." "${iso_checksum}"
|
||||
local cs=$(${iso_checksum}sum $1)
|
||||
msg2 "%s sum: %s" "${iso_checksum}" "${cs}"
|
||||
echo "${cs}" > $1.${iso_checksum}
|
||||
local cs=$(${iso_checksum}sum ${iso_dir}/$1)
|
||||
msg2 "%s sum: %s" "${iso_checksum}" "${cs##*/}"
|
||||
echo "${cs}" > ${iso_dir}/$1.${iso_checksum}
|
||||
msg "Done [%s] sum" "${iso_checksum}"
|
||||
cd ..
|
||||
}
|
||||
|
||||
gen_iso_fn(){
|
||||
local vars=() name
|
||||
vars+=("${iso_name}")
|
||||
if ! ${cal_netinstall};then
|
||||
[[ -n ${profile} ]] && vars+=("${profile}")
|
||||
# [[ ${edition} == 'community' ]] && vars+=("${edition}")
|
||||
else
|
||||
if ${cal_unpackfs};then
|
||||
[[ -n ${profile} ]] && vars+=("${profile}")
|
||||
fi
|
||||
fi
|
||||
[[ ${initsys} == 'openrc' ]] && vars+=("${initsys}")
|
||||
vars+=("${dist_release}")
|
||||
vars+=("${target_branch}")
|
||||
|
@ -212,7 +215,6 @@ make_image_root() {
|
|||
|
||||
pacman -Qr "${path}" > "${path}/root-image-pkgs.txt"
|
||||
copy_overlay "${profile_dir}/root-overlay" "${path}"
|
||||
configure_root_image "${path}"
|
||||
|
||||
reset_pac_conf "${path}"
|
||||
|
||||
|
@ -235,7 +237,6 @@ make_image_custom() {
|
|||
pacman -Qr "${path}" > "${path}/${profile}-image-pkgs.txt"
|
||||
cp "${path}/${profile}-image-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
|
||||
[[ -e ${profile_dir}/${profile}-overlay ]] && copy_overlay "${profile_dir}/${profile}-overlay" "${path}"
|
||||
configure_custom_image "${path}"
|
||||
|
||||
reset_pac_conf "${path}"
|
||||
|
||||
|
@ -359,9 +360,9 @@ make_efi() {
|
|||
make_efiboot() {
|
||||
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
|
||||
msg "Prepare [%s/iso/EFI]" "${iso_name}"
|
||||
local path_iso="${work_dir}/iso"
|
||||
local path_iso="${work_dir}/iso" size="31M"
|
||||
mkdir -p ${path_iso}/EFI/miso
|
||||
truncate -s ${efi_part_size} ${path_iso}/EFI/miso/${iso_name}.img
|
||||
truncate -s ${size} ${path_iso}/EFI/miso/${iso_name}.img
|
||||
mkfs.fat -n MISO_EFI ${path_iso}/EFI/miso/${iso_name}.img
|
||||
mkdir -p ${work_dir}/efiboot
|
||||
mount ${path_iso}/EFI/miso/${iso_name}.img ${work_dir}/efiboot
|
||||
|
@ -658,18 +659,17 @@ reset_profile(){
|
|||
unset plymouth_boot
|
||||
unset nonfree_xorg
|
||||
unset efi_boot_loader
|
||||
unset efi_part_size
|
||||
unset hostname
|
||||
unset username
|
||||
unset plymouth_theme
|
||||
unset password
|
||||
unset addgroups
|
||||
unset start_systemd
|
||||
unset enable_systemd
|
||||
unset disable_systemd
|
||||
unset start_openrc
|
||||
unset enable_openrc
|
||||
unset disable_openrc
|
||||
unset start_systemd_live
|
||||
unset start_openrc_live
|
||||
unset enable_systemd_live
|
||||
unset enable_openrc_live
|
||||
unset packages_custom
|
||||
unset packages_mhwd
|
||||
unset login_shell
|
||||
|
|
36
lib/util.sh
36
lib/util.sh
|
@ -373,6 +373,15 @@ check_profile_vars(){
|
|||
fi
|
||||
}
|
||||
|
||||
get_svc(){
|
||||
local service=${displaymanager}
|
||||
if [[ $service != "sddm" ]] || \
|
||||
[[ $service != "lxdm" ]];then
|
||||
${plymouth_boot} && service="$service-plymouth"
|
||||
fi
|
||||
echo $service
|
||||
}
|
||||
|
||||
load_profile_config(){
|
||||
|
||||
[[ -f $1 ]] || return 1
|
||||
|
@ -397,8 +406,6 @@ load_profile_config(){
|
|||
|
||||
[[ -z ${efi_boot_loader} ]] && efi_boot_loader="grub"
|
||||
|
||||
[[ -z ${efi_part_size} ]] && efi_part_size="31M"
|
||||
|
||||
[[ -z ${hostname} ]] && hostname="manjaro"
|
||||
|
||||
[[ -z ${username} ]] && username="manjaro"
|
||||
|
@ -413,24 +420,29 @@ load_profile_config(){
|
|||
addgroups="video,power,disk,storage,optical,network,lp,scanner,wheel"
|
||||
fi
|
||||
|
||||
if [[ -z ${start_systemd[@]} ]];then
|
||||
start_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
||||
if [[ -z ${enable_systemd[@]} ]];then
|
||||
enable_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
||||
fi
|
||||
|
||||
[[ -z ${disable_systemd[@]} ]] && disable_systemd=('pacman-init')
|
||||
|
||||
if [[ -z ${start_openrc[@]} ]];then
|
||||
start_openrc=('acpid' 'bluetooth' 'cgmanager' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
if [[ -z ${enable_openrc[@]} ]];then
|
||||
enable_openrc=('acpid' 'bluetooth' 'cgmanager' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
fi
|
||||
|
||||
[[ -z ${disable_openrc[@]} ]] && disable_openrc=('pacman-init')
|
||||
[[ -z ${disable_openrc[@]} ]] && disable_openrc=()
|
||||
|
||||
if [[ -z ${start_systemd_live[@]} ]];then
|
||||
start_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init')
|
||||
if [[ -z ${enable_systemd_live[@]} ]];then
|
||||
enable_systemd_live=('manjaro-live' 'mhwd-live' 'pacman-init')
|
||||
fi
|
||||
|
||||
if [[ -z ${start_openrc_live[@]} ]];then
|
||||
start_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init')
|
||||
if [[ -z ${enable_openrc_live[@]} ]];then
|
||||
enable_openrc_live=('manjaro-live' 'mhwd-live' 'pacman-init')
|
||||
fi
|
||||
|
||||
if [[ ${displaymanager} != "none" ]]; then
|
||||
enable_openrc+=('xdm')
|
||||
enable_systemd+=("$(get_svc)")
|
||||
fi
|
||||
|
||||
[[ -z ${tracker_url} ]] && tracker_url='udp://mirror.strits.dk:6969'
|
||||
|
@ -441,7 +453,7 @@ load_profile_config(){
|
|||
|
||||
[[ -z ${cal_unpackfs} ]] && cal_unpackfs='true'
|
||||
|
||||
[[ -z ${cal_netgroups} ]] && cal_netgroups="https://raw.githubusercontent.com/calamares/calamares-manjaro/master/netinstall.yaml"
|
||||
[[ -z ${cal_netgroups} ]] && cal_netgroups="https://raw.githubusercontent.com/calamares/calamares-manjaro/master"
|
||||
|
||||
check_profile_vars
|
||||
|
||||
|
|
Loading…
Reference in a new issue