2015-01-28 21:05:18 +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
|
2016-01-28 18:37:37 +01:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-01-28 21:05:18 +01:00
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
2015-12-06 18:40:05 +01:00
|
|
|
copy_overlay(){
|
2016-02-26 16:10:04 +01:00
|
|
|
msg2 "Copying [%s] ..." "${1##*/}"
|
2015-12-06 18:40:05 +01:00
|
|
|
if [[ -L $1 ]];then
|
|
|
|
cp -a --no-preserve=ownership $1/* $2
|
2015-12-06 05:58:56 +01:00
|
|
|
else
|
2015-12-06 18:40:05 +01:00
|
|
|
cp -LR $1/* $2
|
2015-12-06 05:58:56 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
write_profile_conf_entries(){
|
|
|
|
local conf=$1/profile.conf
|
|
|
|
echo '' >> ${conf}
|
2016-02-25 18:37:29 +01:00
|
|
|
echo '# profile image name' >> ${conf}
|
|
|
|
echo "profile=${profile}" >> ${conf}
|
2015-12-06 05:58:56 +01:00
|
|
|
echo '' >> ${conf}
|
|
|
|
echo '# iso_name' >> ${conf}
|
|
|
|
echo "iso_name=${iso_name}" >> ${conf}
|
|
|
|
}
|
|
|
|
|
2016-02-21 03:05:21 +01:00
|
|
|
copy_profile_conf(){
|
2016-02-21 03:11:01 +01:00
|
|
|
msg2 "Copying profile.conf ..."
|
2015-12-06 05:58:56 +01:00
|
|
|
[[ ! -d $1 ]] && mkdir -p $1
|
|
|
|
|
|
|
|
cp ${profile_conf} $1
|
|
|
|
|
|
|
|
write_profile_conf_entries $1
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_cache_mhwd(){
|
|
|
|
msg2 "Copying mhwd package cache ..."
|
2016-02-21 01:27:50 +01:00
|
|
|
rsync -v --files-from="$1/cache-packages.txt" /var/cache/pacman/pkg "$1/opt/live/pkgs"
|
2015-12-06 05:58:56 +01:00
|
|
|
}
|
|
|
|
|
2015-01-28 21:05:18 +01:00
|
|
|
gen_pw(){
|
2015-02-13 15:17:00 +01:00
|
|
|
echo $(perl -e 'print crypt($ARGV[0], "password")' ${password})
|
2015-01-28 21:05:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# $1: chroot
|
|
|
|
configure_user(){
|
2015-02-13 15:17:00 +01:00
|
|
|
# set up user and password
|
2016-02-29 08:18:25 +01:00
|
|
|
msg2 "Creating user ..."
|
2016-01-20 12:52:27 +01:00
|
|
|
if [[ -n ${password} ]];then
|
2016-01-21 16:40:37 +01:00
|
|
|
chroot $1 useradd -m -G ${addgroups} -p $(gen_pw) ${username}
|
2016-01-20 12:52:27 +01:00
|
|
|
else
|
2016-01-21 16:40:37 +01:00
|
|
|
chroot $1 useradd -m -G ${addgroups} ${username}
|
2016-01-20 12:52:27 +01:00
|
|
|
fi
|
2015-01-28 21:05:18 +01:00
|
|
|
}
|
|
|
|
|
2015-03-04 00:40:44 +01:00
|
|
|
# $1: chroot
|
|
|
|
configure_hosts(){
|
|
|
|
sed -e "s|localhost.localdomain|localhost.localdomain ${hostname}|" -i $1/etc/hosts
|
|
|
|
}
|
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
configure_plymouth(){
|
|
|
|
if ${plymouth_boot};then
|
|
|
|
msg2 "Configuring plymouth: %s" "${plymouth_theme}"
|
|
|
|
local conf=$1/etc/plymouth/plymouthd.conf
|
|
|
|
sed -i -e "s/^.*Theme=.*/Theme=${plymouth_theme}/" "${conf}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-02-24 11:28:10 +01:00
|
|
|
add_svc_rc(){
|
|
|
|
if [[ -f $1/etc/init.d/$2 ]];then
|
|
|
|
msg2 "Setting %s ..." "$2"
|
2016-02-24 16:48:06 +01:00
|
|
|
chroot $1 rc-update add $2 default &>/dev/null
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
2015-01-28 21:05:18 +01:00
|
|
|
}
|
|
|
|
|
2016-02-24 11:28:10 +01:00
|
|
|
add_svc_sd(){
|
|
|
|
if [[ -f $1/etc/systemd/system/$2.service ]] || \
|
|
|
|
[[ -f $1/usr/lib/systemd/system/$2.service ]];then
|
|
|
|
msg2 "Setting %s ..." "$2"
|
2016-02-24 16:48:06 +01:00
|
|
|
chroot $1 systemctl enable $2 &>/dev/null
|
2016-02-24 11:28:10 +01:00
|
|
|
fi
|
2015-01-28 21:05:18 +01:00
|
|
|
}
|
2015-03-11 15:02:54 +01:00
|
|
|
# $1: chroot
|
|
|
|
configure_environment(){
|
2016-02-25 18:37:29 +01:00
|
|
|
case ${profile} in
|
2016-02-26 15:25:46 +01:00
|
|
|
cinnamon*|gnome|i3|lxde|mate|netbook|openbox|pantheon|xfce*)
|
2015-03-11 15:02:54 +01:00
|
|
|
echo "QT_STYLE_OVERRIDE=gtk" >> $1/etc/environment
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2015-01-28 21:05:18 +01:00
|
|
|
# $1: chroot
|
|
|
|
# $2: user
|
|
|
|
configure_accountsservice(){
|
2016-02-29 08:18:25 +01:00
|
|
|
msg2 "Configuring accountsservice ..."
|
2015-02-13 15:17:00 +01:00
|
|
|
local path=$1/var/lib/AccountsService/users
|
|
|
|
if [ -d "${path}" ] ; then
|
|
|
|
echo "[User]" > ${path}/$2
|
2015-05-31 01:26:28 +02:00
|
|
|
echo "XSession=${default_desktop_file}" >> ${path}/$2
|
2015-02-13 15:17:00 +01:00
|
|
|
echo "Icon=/var/lib/AccountsService/icons/$2.png" >> ${path}/$2
|
2015-01-28 21:05:18 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-12-31 01:56:40 +01:00
|
|
|
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}
|
|
|
|
}
|
|
|
|
|
2015-06-10 02:46:14 +02:00
|
|
|
detect_desktop_env(){
|
2015-12-31 01:56:40 +01:00
|
|
|
local xs=$1/usr/share/xsessions ex=$1/usr/bin key val map=( $(load_desktop_map) )
|
2016-02-20 17:52:15 +01:00
|
|
|
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
|
2016-02-29 08:18:25 +01:00
|
|
|
msg2 "Detected desktop environment: %s" "${default_desktop_file}"
|
2015-06-10 02:46:14 +02:00
|
|
|
}
|
|
|
|
|
2016-02-24 11:28:10 +01:00
|
|
|
set_xdm(){
|
|
|
|
if [[ -f $1/etc/conf.d/xdm ]];then
|
|
|
|
local conf='DISPLAYMANAGER="'${displaymanager}'"'
|
|
|
|
sed -i -e "s|^.*DISPLAYMANAGER=.*|${conf}|" $1/etc/conf.d/xdm
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
is_valid_de(){
|
|
|
|
local func=$1
|
|
|
|
if [[ ${default_desktop_executable} != "none" ]] && \
|
2016-02-29 19:51:24 +01:00
|
|
|
[[ ${default_desktop_file} != "none" ]]; then
|
|
|
|
return 0
|
2016-02-29 08:18:25 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2015-06-10 02:46:14 +02:00
|
|
|
# $1: chroot
|
|
|
|
configure_displaymanager(){
|
|
|
|
msg2 "Configuring Displaymanager ..."
|
|
|
|
# Try to detect desktop environment
|
|
|
|
detect_desktop_env "$1"
|
2015-05-31 01:26:28 +02:00
|
|
|
# Configure display manager
|
2015-02-13 15:17:00 +01:00
|
|
|
case ${displaymanager} in
|
|
|
|
'lightdm')
|
|
|
|
chroot $1 groupadd -r autologin
|
2016-02-29 08:18:25 +01:00
|
|
|
[[ ${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
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
|
|
|
;;
|
2016-02-29 08:18:25 +01:00
|
|
|
'gdm') configure_accountsservice "$1" "gdm" ;;
|
2015-02-13 15:17:00 +01:00
|
|
|
'mdm')
|
2016-02-29 08:18:25 +01:00
|
|
|
if $(is_valid_de); then
|
|
|
|
sed -i "s|default.desktop|$default_desktop_file.desktop|g" $1/etc/mdm/custom.conf
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
'sddm')
|
2016-02-29 08:18:25 +01:00
|
|
|
[[ ${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
|
2016-02-03 23:58:02 +01:00
|
|
|
fi
|
2015-02-13 15:17:00 +01:00
|
|
|
;;
|
|
|
|
'lxdm')
|
2016-02-29 08:18:25 +01:00
|
|
|
if $(is_valid_de); then
|
|
|
|
sed -i -e "s|^.*session=.*|session=/usr/bin/$default_desktop_executable|" $1/etc/lxdm/lxdm.conf
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
msg2 "Configured: ${displaymanager}"
|
2015-01-28 21:05:18 +01:00
|
|
|
}
|
2015-01-29 00:17:15 +01:00
|
|
|
|
2015-03-11 15:02:54 +01:00
|
|
|
# $1: chroot
|
2015-07-04 10:54:56 +02:00
|
|
|
configure_mhwd_drivers(){
|
2016-02-24 11:28:10 +01:00
|
|
|
local path=$1/opt/live/pkgs/ \
|
2016-02-29 08:18:25 +01:00
|
|
|
drv_path=$1/var/lib/mhwd/db/pci/graphic_drivers
|
|
|
|
info "Configuring mwwd db ..."
|
2016-02-24 11:28:10 +01:00
|
|
|
if [ -z "$(ls $path | grep catalyst-utils 2> /dev/null)" ]; then
|
2015-02-13 15:17:00 +01:00
|
|
|
msg2 "Disabling Catalyst driver"
|
2016-02-24 11:28:10 +01:00
|
|
|
mkdir -p $drv_path/catalyst/
|
|
|
|
touch $drv_path/catalyst/MHWDCONFIG
|
2015-01-29 00:17:15 +01:00
|
|
|
fi
|
2016-02-24 11:28:10 +01:00
|
|
|
if [ -z "$(ls $path | grep nvidia-utils 2> /dev/null)" ]; then
|
2015-02-13 15:17:00 +01:00
|
|
|
msg2 "Disabling Nvidia driver"
|
2016-02-24 11:28:10 +01:00
|
|
|
mkdir -p $drv_path/nvidia/
|
|
|
|
touch $drv_path/nvidia/MHWDCONFIG
|
2015-02-13 15:17:00 +01:00
|
|
|
msg2 "Disabling Nvidia Bumblebee driver"
|
2016-02-24 11:28:10 +01:00
|
|
|
mkdir -p $drv_path/hybrid-intel-nvidia-bumblebee/
|
|
|
|
touch $drv_path/hybrid-intel-nvidia-bumblebee/MHWDCONFIG
|
2015-01-29 00:17:15 +01:00
|
|
|
fi
|
2016-02-24 11:28:10 +01:00
|
|
|
if [ -z "$(ls $path | grep nvidia-304xx-utils 2> /dev/null)" ]; then
|
2015-02-13 15:17:00 +01:00
|
|
|
msg2 "Disabling Nvidia 304xx driver"
|
2016-02-24 11:28:10 +01:00
|
|
|
mkdir -p $drv_path/nvidia-304xx/
|
|
|
|
touch $drv_path/nvidia-304xx/MHWDCONFIG
|
2015-01-29 00:17:15 +01:00
|
|
|
fi
|
2016-02-24 11:28:10 +01:00
|
|
|
if [ -z "$(ls $path | grep nvidia-340xx-utils 2> /dev/null)" ]; then
|
2015-02-13 15:17:00 +01:00
|
|
|
msg2 "Disabling Nvidia 340xx driver"
|
2016-02-24 11:28:10 +01:00
|
|
|
mkdir -p $drv_path/nvidia-340xx/
|
|
|
|
touch $drv_path/nvidia-340xx/MHWDCONFIG
|
2015-01-29 00:17:15 +01:00
|
|
|
fi
|
2016-02-24 11:28:10 +01:00
|
|
|
if [ -z "$(ls $path | grep xf86-video-amdgpu 2> /dev/null)" ]; then
|
2016-02-06 09:31:48 +01:00
|
|
|
msg2 "Disabling AMD gpu driver"
|
2016-02-24 11:28:10 +01:00
|
|
|
mkdir -p $drv_path/xf86-video-amdgpu/
|
|
|
|
touch $drv_path/xf86-video-amdgpu/MHWDCONFIG
|
2016-02-06 09:31:48 +01:00
|
|
|
fi
|
2015-01-29 00:17:15 +01:00
|
|
|
}
|
2015-05-21 19:54:29 +02:00
|
|
|
|
2015-06-04 15:20:04 +02:00
|
|
|
chroot_clean(){
|
2015-05-21 19:54:29 +02:00
|
|
|
msg "Cleaning up ..."
|
|
|
|
for image in "$1"/*-image; do
|
|
|
|
[[ -d ${image} ]] || continue
|
2016-02-26 15:25:46 +01:00
|
|
|
local name=${image##*/}
|
|
|
|
if [[ $name != "mhwd-image" ]];then
|
2016-02-26 16:10:04 +01:00
|
|
|
msg2 "Deleting chroot [%s] ..." "$name"
|
2015-05-21 19:54:29 +02:00
|
|
|
lock 9 "${image}.lock" "Locking chroot '${image}'"
|
|
|
|
if [[ "$(stat -f -c %T "${image}")" == btrfs ]]; then
|
2016-02-23 22:00:59 +01:00
|
|
|
{ type -P btrfs && btrfs subvolume delete "${image}"; } #&> /dev/null
|
2015-05-21 19:54:29 +02:00
|
|
|
fi
|
|
|
|
rm -rf --one-file-system "${image}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
exec 9>&-
|
|
|
|
rm -rf --one-file-system "$1"
|
|
|
|
}
|
|
|
|
|
2016-02-24 11:28:10 +01:00
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2016-02-24 00:06:27 +01:00
|
|
|
# $1: chroot
|
|
|
|
configure_lsb(){
|
|
|
|
[[ -f $1/boot/grub/grub.cfg ]] && rm $1/boot/grub/grub.cfg
|
|
|
|
if [ -e $1/etc/lsb-release ] ; then
|
|
|
|
msg2 "Configuring lsb-release"
|
|
|
|
sed -i -e "s/^.*DISTRIB_RELEASE.*/DISTRIB_RELEASE=${dist_release}/" $1/etc/lsb-release
|
|
|
|
sed -i -e "s/^.*DISTRIB_CODENAME.*/DISTRIB_CODENAME=${dist_codename}/" $1/etc/lsb-release
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-02-24 11:28:10 +01:00
|
|
|
configure_mhwd(){
|
|
|
|
if [[ ${arch} == "x86_64" ]];then
|
|
|
|
if ! ${multilib};then
|
|
|
|
msg2 "Disable mhwd lib32 support"
|
|
|
|
echo 'MHWD64_IS_LIB32="false"' > $1/etc/mhwd-x86_64.conf
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
configure_logind(){
|
|
|
|
msg2 "Configuring logind ..."
|
|
|
|
local conf=$1/etc/systemd/logind.conf
|
|
|
|
sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' "$conf"
|
|
|
|
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' "$conf"
|
2016-02-24 00:06:27 +01:00
|
|
|
}
|
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
configure_logind_live(){
|
|
|
|
msg2 "Configuring logind ..."
|
|
|
|
local conf=$1/etc/systemd/logind.conf
|
|
|
|
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' "$conf"
|
2016-02-24 00:06:27 +01:00
|
|
|
}
|
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
configure_journald(){
|
|
|
|
msg2 "Configuring journald ..."
|
|
|
|
local conf=$1/etc/systemd/journald.conf
|
|
|
|
sed -i 's/#\(Storage=\)auto/\1volatile/' "$conf"
|
|
|
|
}
|
2015-06-17 00:19:42 +02:00
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
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}
|
2015-09-25 16:44:08 +02:00
|
|
|
}
|
|
|
|
|
2016-02-29 08:18:25 +01:00
|
|
|
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
|
2015-09-22 07:36:28 +02:00
|
|
|
fi
|
2016-02-29 08:18:25 +01:00
|
|
|
echo $service
|
2015-09-22 07:36:28 +02:00
|
|
|
}
|
|
|
|
|
2016-02-24 11:28:10 +01:00
|
|
|
configure_services(){
|
2016-02-26 15:25:46 +01:00
|
|
|
info "Configuring [%s]" "${initsys}"
|
2016-02-24 11:28:10 +01:00
|
|
|
case ${initsys} in
|
|
|
|
'openrc')
|
|
|
|
for svc in ${start_openrc[@]}; 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
|
|
|
|
add_svc_sd "$1" "$svc"
|
|
|
|
done
|
|
|
|
if [[ ${displaymanager} != "none" ]];then
|
2016-03-01 14:16:30 +01:00
|
|
|
add_svc_sd "$1" "$(get_svc_dm $1)"
|
2016-02-24 11:28:10 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
info "Done configuring [%s]" "${initsys}"
|
|
|
|
}
|
|
|
|
|
|
|
|
configure_services_live(){
|
2016-02-26 15:25:46 +01:00
|
|
|
info "Configuring [%s]" "${initsys}"
|
2016-02-24 11:28:10 +01:00
|
|
|
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
|
|
|
|
add_svc_sd "$1" "$svc"
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
info "Done configuring [%s]" "${initsys}"
|
2015-06-25 02:25:05 +02:00
|
|
|
}
|
|
|
|
|
2015-06-17 00:19:42 +02:00
|
|
|
configure_root_image(){
|
|
|
|
msg "Configuring [root-image]"
|
|
|
|
configure_lsb "$1"
|
|
|
|
configure_mhwd "$1"
|
2016-02-29 08:18:25 +01:00
|
|
|
|
|
|
|
case ${initsys} in
|
|
|
|
'systemd')
|
|
|
|
configure_logind "$1"
|
|
|
|
;;
|
|
|
|
'openrc')
|
|
|
|
configure_sysctl "$1"
|
|
|
|
rm $1/etc/runlevels/boot/hwclock
|
|
|
|
;;
|
|
|
|
esac
|
2015-06-17 00:19:42 +02:00
|
|
|
msg "Done configuring [root-image]"
|
|
|
|
}
|
|
|
|
|
2015-05-21 19:54:29 +02:00
|
|
|
configure_custom_image(){
|
2016-02-25 18:37:29 +01:00
|
|
|
msg "Configuring [%s-image]" "${profile}"
|
2016-02-29 08:18:25 +01:00
|
|
|
configure_plymouth "$1"
|
2015-05-21 19:54:29 +02:00
|
|
|
configure_displaymanager "$1"
|
|
|
|
configure_services "$1"
|
2016-02-25 18:37:29 +01:00
|
|
|
msg "Done configuring [%s-image]" "${profile}"
|
2015-05-21 19:54:29 +02:00
|
|
|
}
|
|
|
|
|
2015-12-18 18:25:13 +01:00
|
|
|
configure_live_image(){
|
|
|
|
msg "Configuring [live-image]"
|
2015-05-21 19:54:29 +02:00
|
|
|
configure_hosts "$1"
|
|
|
|
configure_user "$1"
|
2016-02-26 16:10:04 +01:00
|
|
|
configure_accountsservice "$1" "${username}"
|
2016-02-29 08:18:25 +01:00
|
|
|
configure_pamac_live "$1"
|
|
|
|
configure_environment "$1"
|
|
|
|
case ${initsys} in
|
|
|
|
'systemd')
|
|
|
|
configure_logind_live "$1"
|
|
|
|
configure_journald "$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
|
|
|
|
;;
|
|
|
|
'openrc')
|
|
|
|
msg2 "Configuring hostname ..."
|
|
|
|
local _hostname='hostname="'${hostname}'"'
|
|
|
|
sed -i -e "s|^.*hostname=.*|${_hostname}|" $1/etc/conf.d/hostname
|
|
|
|
;;
|
|
|
|
esac
|
2015-05-21 19:54:29 +02:00
|
|
|
configure_services_live "$1"
|
|
|
|
configure_calamares "$1"
|
|
|
|
configure_thus "$1"
|
2015-12-18 18:25:13 +01:00
|
|
|
msg "Done configuring [live-image]"
|
2015-05-21 19:54:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
make_repo(){
|
2016-02-21 01:27:50 +01:00
|
|
|
repo-add $1/opt/live/pkgs/gfx-pkgs.db.tar.gz $1/opt/live/pkgs/*pkg*z
|
2015-05-21 19:54:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# $1: work dir
|
2015-06-08 21:21:46 +02:00
|
|
|
# $2: pkglist
|
2015-05-21 19:54:29 +02:00
|
|
|
download_to_cache(){
|
2015-06-08 21:21:46 +02:00
|
|
|
chroot-run \
|
|
|
|
-r "${mountargs_ro}" \
|
|
|
|
-w "${mountargs_rw}" \
|
|
|
|
-B "${build_mirror}/${branch}" \
|
|
|
|
"$1" \
|
2015-07-03 23:28:13 +02:00
|
|
|
pacman -v -Syw $2 --noconfirm || return 1
|
2015-06-08 21:21:46 +02:00
|
|
|
chroot-run \
|
|
|
|
-r "${mountargs_ro}" \
|
|
|
|
-w "${mountargs_rw}" \
|
|
|
|
-B "${build_mirror}/${branch}" \
|
|
|
|
"$1" \
|
2015-06-08 21:35:18 +02:00
|
|
|
pacman -v -Sp $2 --noconfirm > "$1"/cache-packages.txt
|
2015-06-08 21:21:46 +02:00
|
|
|
sed -ni '/.pkg.tar.xz/p' "$1"/cache-packages.txt
|
|
|
|
sed -i "s/.*\///" "$1"/cache-packages.txt
|
2015-05-21 19:54:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# $1: image path
|
|
|
|
# $2: packages
|
2015-06-04 15:20:04 +02:00
|
|
|
chroot_create(){
|
2015-05-21 19:54:29 +02:00
|
|
|
[[ "$1" == "${work_dir}/root-image" ]] && local flag="-L"
|
|
|
|
setarch "${arch}" \
|
2015-06-29 04:08:45 +02:00
|
|
|
mkchroot ${mkchroot_args[*]} ${flag} $@
|
2015-05-21 19:54:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# $1: image path
|
|
|
|
clean_up_image(){
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "Cleaning up [%s]" "${1##*/}"
|
2016-02-23 22:00:59 +01:00
|
|
|
[[ -d "$1/boot/" ]] && find "$1/boot" -name 'initramfs*.img' -delete #&> /dev/null
|
2015-05-21 19:54:29 +02:00
|
|
|
[[ -f "$1/etc/locale.gen.bak" ]] && mv "$1/etc/locale.gen.bak" "$1/etc/locale.gen"
|
|
|
|
[[ -f "$1/etc/locale.conf.bak" ]] && mv "$1/etc/locale.conf.bak" "$1/etc/locale.conf"
|
|
|
|
|
2016-02-23 22:00:59 +01:00
|
|
|
find "$1/var/lib/pacman" -maxdepth 1 -type f -delete #&> /dev/null
|
|
|
|
find "$1/var/lib/pacman/sync" -type f -delete #&> /dev/null
|
2016-02-23 18:23:28 +01:00
|
|
|
#find "$1/var/cache/pacman/pkg" -type f -delete &> /dev/null
|
2016-02-23 22:00:59 +01:00
|
|
|
find "$1/var/log" -type f -delete #&> /dev/null
|
2016-02-23 18:23:28 +01:00
|
|
|
#find "$1/var/tmp" -mindepth 1 -delete &> /dev/null
|
|
|
|
#find "$1/tmp" -mindepth 1 -delete &> /dev/null
|
2015-05-21 19:54:29 +02:00
|
|
|
|
|
|
|
# find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete
|
|
|
|
}
|
2016-02-25 15:51:25 +01:00
|
|
|
|
|
|
|
clean_up_mhwd_image(){
|
|
|
|
msg2 "Cleaning up [%s]" "${1##*/}"
|
|
|
|
rm -r $1/var
|
|
|
|
rm -rf "$1/etc"
|
|
|
|
rm -f "$1/cache-packages.txt"
|
|
|
|
}
|