forked from mirrored-repos/manjaro-tools
buildiso: move live config stuff to livecd repo
This commit is contained in:
parent
e890543166
commit
274c4f1707
9 changed files with 30 additions and 213 deletions
1
Makefile
1
Makefile
|
@ -77,7 +77,6 @@ LIBS_ISO = \
|
|||
|
||||
SHARED_ISO = \
|
||||
data/pacman-gfx.conf \
|
||||
data/desktop.map \
|
||||
data/profile.conf.example
|
||||
|
||||
CPIOHOOKS = \
|
||||
|
|
|
@ -39,7 +39,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}"
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
openbox:openbox-session
|
||||
bspwm:bspwm-session
|
||||
jwm:jwm
|
||||
i3:i3
|
||||
fluxbox:startfluxbox
|
||||
pekwm:pekwm
|
||||
plasma:startkde
|
||||
gnome:gnome-session
|
||||
xfce:startxfce4
|
||||
cinnamon:cinnamon-session-cinnamon
|
||||
mate:mate-session
|
||||
enlightenment:enlightenment_start
|
||||
LXDE:lxsession
|
||||
lxqt:lxqt-session
|
||||
pantheon:pantheon-session
|
||||
budgie-desktop:budgie-desktop
|
||||
deepin:startdde
|
|
@ -34,9 +34,6 @@
|
|||
# possible values: grub;systemd-boot
|
||||
# efi_boot_loader="grub"
|
||||
|
||||
# set uefi partition size
|
||||
# efi_part_size=31M
|
||||
|
||||
# configure calamares for netinstall
|
||||
# cal_netinstall="false"
|
||||
|
||||
|
@ -59,23 +56,23 @@
|
|||
# enable_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
||||
# disable_openrc=()
|
||||
|
||||
################# live-session #################
|
||||
|
||||
# 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 enable_systemd array don't need to be listed here
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -211,7 +211,11 @@ write_settings_conf(){
|
|||
echo " - hardwarecfg" >> "$conf"
|
||||
echo " - networkcfg" >> "$conf"
|
||||
echo " - hwclock" >> "$conf"
|
||||
echo " - services" >> "$conf"
|
||||
if [[ ${initsys} == 'systemd' ]];then
|
||||
echo " - services" >> "$conf"
|
||||
else
|
||||
echo " - servicescfg" >> "$conf"
|
||||
fi
|
||||
echo " - grubcfg" >> "$conf"
|
||||
echo " - bootloader" >> "$conf"
|
||||
echo " - postcfg" >> "$conf"
|
||||
|
|
|
@ -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,80 +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-gtk-greeter) break ;;
|
||||
lightdm-*-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/ \
|
||||
|
@ -249,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(){
|
||||
|
@ -355,19 +200,24 @@ 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}
|
||||
}
|
||||
|
||||
configure_hostname(){
|
||||
msg2 "Configuring hostname ..."
|
||||
case ${initsys} in
|
||||
'systemd') echo ${hostname} > $1/etc/hostname ;;
|
||||
'openrc') local hn='hostname="'${hostname}'"'; sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname ;;
|
||||
esac
|
||||
configure_hosts(){
|
||||
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
|
||||
}
|
||||
|
||||
configure_system(){
|
||||
|
@ -382,9 +232,13 @@ configure_system(){
|
|||
|
||||
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')
|
||||
configure_sysctl "$1"
|
||||
local hn='hostname="'${hostname}'"'
|
||||
sed -i -e "s|^.*hostname=.*|${hn}|" $1/etc/conf.d/hostname
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -392,15 +246,9 @@ configure_system(){
|
|||
configure_live_image(){
|
||||
msg "Configuring [live-image]"
|
||||
configure_hosts "$1"
|
||||
configure_user "$1"
|
||||
configure_accountsservice "$1" "${username}"
|
||||
configure_pamac_live "$1"
|
||||
configure_environment "$1"
|
||||
configure_plymouth "$1"
|
||||
configure_lsb "$1"
|
||||
configure_mhwd "$1"
|
||||
[[ ${displaymanager} != 'none' ]] && configure_displaymanager "$1"
|
||||
configure_hostname "$1"
|
||||
configure_system "$1"
|
||||
configure_services "$1"
|
||||
configure_calamares "$1"
|
||||
|
|
|
@ -357,9 +357,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
|
||||
|
@ -656,7 +656,6 @@ reset_profile(){
|
|||
unset plymouth_boot
|
||||
unset nonfree_xorg
|
||||
unset efi_boot_loader
|
||||
unset efi_part_size
|
||||
unset hostname
|
||||
unset username
|
||||
unset plymouth_theme
|
||||
|
|
|
@ -397,8 +397,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"
|
||||
|
|
Loading…
Reference in a new issue