nix-tools/livecd/livecd
2014-12-11 05:03:23 +01:00

252 lines
9.4 KiB
Bash
Executable file

#!/bin/sh
[[ -r /opt/livecd/util-config.sh ]] && source /opt/livecd/util-config.sh
load_config "/opt/livecd/manjaro-tools.conf"
[[ -r /opt/livecd/util.sh ]] && source /opt/livecd/util.sh
[[ -r /opt/livecd/util-lng.sh ]] && source /opt/livecd/util-lng.sh
CONSOLEFONT="$(kernel_cmdline vconsole.font)"
CONSOLEMAP="$(kernel_cmdline vconsole.font.map)"
PACMAN_LNG="pacman --config /opt/livecd/pacman-lng.conf --noconfirm --noprogressbar"
arch=$(uname -m)
_kernver=$(uname -r)
_kernver=${_kernver%%-*}
_kernver=${_kernver%%.[00-99].[00-99]}
EXTRAMODULES=extramodules-${_kernver}-MANJARO
echo "update fstab for swap" > /tmp/livecd.log
## Systemd should do it
# scan_swap
swapdev="$(fdisk -l 2>/dev/null | grep swap | cut -d' ' -f1)"
if [ -e "${swapdev}" ]; then
swapon ${swapdev}
echo "${swapdev} swap swap defaults 0 0 #configured by manjaroiso" >>/etc/fstab
fi
echo "set locale" >> /tmp/livecd.log
# set_locale
set_locale
locale-gen
echo "configure alsa" >> /tmp/livecd.log
# configure alsa
set_alsa
# configure pulse
if [ -e "/usr/bin/pulseaudio-ctl" ] ; then
pulseaudio-ctl normal
fi
# save settings
alsactl -f /etc/asound.state store &>/dev/null
echo "enable default mirror" >> /tmp/livecd.log
# enable default mirror
#cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
#if [ ! -z "$ping_check" ] ; then
# pacman-mirrors -g &>/dev/null
#fi
echo "configure system" >> /tmp/livecd.log
# add BROWSER var
echo "BROWSER=/usr/bin/xdg-open" >> /etc/environment
echo "BROWSER=/usr/bin/xdg-open" >> /etc/skel/.bashrc
echo "BROWSER=/usr/bin/xdg-open" >> /etc/profile
# add TERM var
if [ -e "/usr/bin/mate-session" ] ; then
echo "TERM=mate-terminal" >> /etc/environment
echo "TERM=mate-terminal" >> /etc/profile
fi
## FIXME - Workaround to launch mate-terminal
if [ -e "/usr/bin/mate-session" ] ; then
sed -i -e "s~^.*Exec=.*~Exec=mate-terminal -e 'sudo setup'~" "/etc/skel/Desktop/installer-launcher-cli.desktop"
sed -i -e "s~^.*Terminal=.*~Terminal=false~" "/etc/skel/Desktop/installer-launcher-cli.desktop"
fi
echo "configure user" >> /tmp/livecd.log
cp -a /etc/skel/. /home/${username}
# do_configsforroot
cp -a /etc/skel/. /root/
echo "configure sudoers" >> /tmp/livecd.log
# do_fix_perms
chown root:root /etc/sudoers
sed -i -e 's|# %wheel ALL=(ALL) ALL|%wheel ALL=(ALL) ALL|g' /etc/sudoers
chmod 440 /etc/sudoers
echo "configure applications" >> /tmp/livecd.log
# fix_gnome_apps
glib-compile-schemas /usr/share/glib-2.0/schemas
gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor
if [ -e "/usr/bin/dconf" ] ; then
dconf update
fi
if [ -e "/usr/bin/gnome-keyring-daemon" ] ; then
setcap cap_ipc_lock=ep /usr/bin/gnome-keyring-daemon &> /dev/null
fi
# configurate pacman
#pacman-key --init
#pacman-key --populate archlinux manjaro
# fix_ping_installation
setcap cap_net_raw=ep /usr/bin/ping &> /dev/null
setcap cap_net_raw=ep /usr/bin/ping6 &> /dev/null
# installing localization packages
if [ -e "/bootmnt/${install_dir}/${arch}/lng-image.sqfs" ] ; then
echo "install translation packages" >> /tmp/livecd.log
_configure_translation_pkgs
${PACMAN_LNG} -Sy
if [ -e "/bootmnt/${install_dir}/${arch}/kde-image.sqfs" ] ; then
${PACMAN_LNG} -S ${KDE_LNG_INST} &> /dev/null
fi
if [ -e "/usr/bin/firefox" ] ; then
${PACMAN_LNG} -S ${FIREFOX_LNG_INST} &> /dev/null
fi
if [ -e "/usr/bin/thunderbird" ] ; then
${PACMAN_LNG} -S ${THUNDER_LNG_INST} &> /dev/null
fi
if [ -e "/usr/bin/libreoffice" ] ; then
${PACMAN_LNG} -S ${LIBRE_LNG_INST} &> /dev/null
fi
if [ -e "/usr/bin/hunspell" ] ; then
${PACMAN_LNG} -S ${HUNSPELL_LNG_INST} &> /dev/null
fi
fi
# set unique machine-id
#dbus-uuidgen --ensure=/etc/machine-id
#dbus-uuidgen --ensure=/var/lib/dbus/machine-id
# depmod extramodules
depmod $(cat /usr/lib/modules/$EXTRAMODULES/version)
# check if we are running inside a virtual machine and unistall kalu
DESTDIR="/"
if [ -e "/usr/bin/kalu" ] ; then
_rm_kalu
fi
if [ -e "/etc/live-installer/install.conf" ] ; then
echo "configure live-installer" >> /tmp/livecd.log
_conf_file="/etc/live-installer/install.conf"
fi
if [ -e "/etc/thus.conf" ] ; then
echo "configure thus" >> /tmp/livecd.log
_conf_file="/etc/thus.conf"
fi
if [ -e "$_conf_file" ] ; then
sed -i "s|_root-image_|/bootmnt/${install_dir}/_ARCH_/root-image.sqfs|g" $_conf_file
sed -i "s|_kernel_|$manjaro_kernel|g" $_conf_file
release=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d= -f2)
sed -i "s|_version_|$release|g" $_conf_file
if [ -e "/bootmnt/${install_dir}/${arch}/xfce-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/xfce-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro XFCE Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/gnome-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/gnome-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro Gnome Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/cinnamon-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/cinnamon-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro Cinnamon Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/openbox-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/openbox-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro Openbox Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/mate-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/mate-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro MATE Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/kde-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/kde-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro KDE Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/lxde-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/lxde-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro LXDE Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/lxqt-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/lxqt-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro LXQt Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/enlightenment-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/enlightenment-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro Enlightenment Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/pekwm-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/pekwm-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro PekWM Edition|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/custom-image.sqfs" ] ; then
sed -i "s|_desktop_|/bootmnt/${install_dir}/_ARCH_/custom-image.sqfs|g" $_conf_file
sed -i "s|_title_|Manjaro Custom Edition|g" $_conf_file
fi
if [ "${arch}" == "i686" ] ; then
sed -i "s|_ARCH_|i686|g" $_conf_file
else
sed -i "s|_ARCH_|x86_64|g" $_conf_file
fi
fi
if [ -e "/usr/share/calamares/settings.conf" ] ; then
echo "configure calamares" >> /tmp/livecd.log
_conf_file="/usr/share/calamares/modules/unpackfs.conf"
sed -i "s|_root-image_|/bootmnt/${install_dir}/_ARCH_/root-image.sqfs|g" $_conf_file
sed -i "s|_kernel_|$manjaro_kernel|g" "/usr/share/calamares/modules/initcpio.conf"
if [ -e "/bootmnt/${install_dir}/${arch}/xfce-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/xfce-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/gnome-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/gnome-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/cinnamon-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/cinnamon-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/openbox-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/openbox-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/mate-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/mate-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/kde-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/kde-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/lxde-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/lxde-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/lxqt-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/lxqt-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/enlightenment-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/enlightenment-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/pekwm-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/pekwm-image.sqfs|g" $_conf_file
fi
if [ -e "/bootmnt/${install_dir}/${arch}/custom-image.sqfs" ] ; then
sed -i "s|_desktop-image_|/bootmnt/${install_dir}/_ARCH_/custom-image.sqfs|g" $_conf_file
fi
if [ "${arch}" == "i686" ] ; then
sed -i "s|_ARCH_|i686|g" $_conf_file
else
sed -i "s|_ARCH_|x86_64|g" $_conf_file
fi
fi