File config.sh of Package lxqt-live

#!/bin/bash
#================
# FILE          : config.sh
#----------------
# PROJECT       : openSUSE KIWI Image System
# COPYRIGHT     : (c) 2006,2007,2008,2017 SUSE Linux GmbH. All rights reserved
#               :
# AUTHOR        : Marcus Schaefer <ms@suse.de>, Stephan Kulow <coolo@suse.de>, Fabian Vogt <fvogt@suse.com>
#               :
# LICENSE       : BSD
#======================================
# Functions...
#--------------------------------------
test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile

set -euox pipefail

exec | tee /var/log/config.log
exec 2>&1

#pl=$(rpmqpack | grep package-lists-)
#test -z "$pl" || rpm -e $pl

# Get the flavor from the installed package-lists- RPM
# as <censored> kiwi does not make the flavor accessible
#desktop=$(echo "$pl" | awk -F- '{ print $4 }' | tr A-Z a-z)
desktop=x11

#--------------------------------------
# enable and disable services

for i in langset NetworkManager firewalld spice-vdagentd; do
	systemctl -f enable $i
done
for i in sshd cron wicked purge-kernels; do
	systemctl -f disable $i
done

cd /

# Import keys for installation
touch /installkey.gpg
gpg --batch --homedir /root/.gnupg --no-default-keyring --ignore-time-conflict --ignore-valid-from --keyring /installkey.gpg --import /usr/lib/rpm/gnupg/keys/*
mkdir -p /pubkeys
for i in /usr/lib/rpm/gnupg/keys/*.asc ; do
	rpm --import $i || true
	ln -s "$i" "/pubkeys/${i##*/}.key"
done
for i in /rpmkeys/*.key ; do
        rpm --import $i || true
done
rm -rf /rpmkeys

# Craft license.tar.gz used by YaST
(cd /usr/share/licenses/openSUSE-release; tar -cvzf /license.tar.gz *)

# Remove netronome firmware (part of kernel-firmware): this sums up to 125MB
# Save 50 MiB by removing this, not very useful for lives
rm -rf /lib/firmware/{liquidio,netronome}

# Remove some large locales to save space
#rm -rf /usr/share/locale/{ca,cs,da,de,es,fr,it,ja,nl,pl,pt_BR,sv,uk,vi,zh_CN}
find /usr/share/locale/* -maxdepth 0 -type d -not -name 'ru' -not -name 'ru_RU' | xargs rm -rf
find /usr/share/help/* -maxdepth 0 -type d -not -name 'C' -not -name 'ru' -not -name 'ru_RU' | xargs rm -rf
for i in $(find /usr/share/ -type d -name 'translations') ; do
    find $i -type f -not -name '*_ru.qm' -not -name '*_ru_RU.qm' -exec rm -f {} \;
done

# Remove duplicate licenses
_target="";
fdupes -q -p -n -H -o time -r /usr/share/licenses/ |
  while read _file; do
    if test -z "$_target" ; then
      _target="$_file";
    else
      if test -z "$_file" ; then
        _target="";
        continue ;
      fi ;
        ln -f "$_target" "$_file";
    fi ;
done

# Some packages really exaggerate here
rm -rf /usr/share/doc/ghostscript/*
rm -rf /usr/share/doc/packages/*

# Add repos from /etc/YaST2/control.xml
eval $(xsltproc /geturls.xsl /etc/YaST2/control.xml)
rm /geturls.xsl
zypper ar -f -n "LXQt-Tumbleweed" http://download.opensuse.org/repositories/home:/AndnoVember:/LXQt/openSUSE_Tumbleweed/ lxqt
zypper ar -f -n "Packman-Tumbleweed" http://packman.inode.at/suse/openSUSE_Tumbleweed/ packman
zypper ar -f -n "libdvdcss-Tumbleweed" http://opensuse-guide.org/repo/openSUSE_Tumbleweed/ libdvdcss

#======================================
# /etc/sudoers hack to fix #297695 
# (Installation Live CD: no need to ask for password of root)
#--------------------------------------
sed -i -e "s/ALL\tALL=(ALL) ALL/ALL ALL=(ALL) NOPASSWD: ALL/" /etc/sudoers 
chmod 0440 /etc/sudoers

/usr/sbin/useradd -m -u 1000 linux -c "Live-CD User" -p ""
#/usr/sbin/useradd -m -u 1000 linux -c "Live-CD User" -p '$6$HnhRgXpb85os1xnv$/q9lyggzwlfNtm4rNPvTXBmMqxgisXLA1RaV.MBMoghv318itvttO7F2rg3A1P/Gs1g5pmhAFTGhke1Fp66v.0'
#/usr/sbin/usermod -p '$6$lN2kEqjPYu9JF0wW$E1rOwqyQR3D9kcOAMAv6QO6sLPsMbaH5fqnkEuZKPUNR.AQ/tsJMiUs0MDSdI.w5wHcl2s.iJPIDXpsG.t7W/.' root

# delete passwords
passwd -d root
passwd -d linux
# empty password is ok
pam-config -a --nullok

: > /var/log/zypper.log

if [ "$desktop" != "kde" ]; then
    # Add Installation icon to desktop folder
    mkdir -p /home/linux/.config /home/linux/Desktop
    echo 'XDG_DESKTOP_DIR="$HOME/Desktop"' > /home/linux/.config/user-dirs.dirs
    ln -s /usr/share/applications/installation.desktop /home/linux/Desktop/
    ln -s /usr/share/applications/upgrade.desktop /home/linux/Desktop/
    # Set the application as being "trusted"
    chmod a+x /home/linux/Desktop/installation.desktop
    chmod a+x /home/linux/Desktop/upgrade.desktop
#else
#    # bug 989897, avoid creating desktop directory on KDE so that the default items are added on first login
#    cp /usr/share/applications/installation.desktop /usr/share/kio_desktop/DesktopLinks/
#    # Set the application as being "trusted"
#    chmod a+x /usr/share/kio_desktop/DesktopLinks/installation.desktop
# else case disabled: 'x11' (rescue) does not contain the installer, GNOME Shell has no concept of 'desktop'
fi

chown -R linux /home/linux

chkstat --system --set

ln -s /usr/lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
baseUpdateSysConfig /etc/sysconfig/displaymanager DISPLAYMANAGER_AUTOLOGIN linux
baseUpdateSysConfig /etc/sysconfig/keyboard KEYTABLE us.map.gz
baseUpdateSysConfig /etc/sysconfig/keyboard YAST_KEYBOARD "english-us,pc104"
baseUpdateSysConfig /etc/sysconfig/keyboard COMPOSETABLE "clear latin1.add"

baseUpdateSysConfig /etc/sysconfig/language RC_LANG ""

baseUpdateSysConfig /etc/sysconfig/console CONSOLE_FONT "eurlatgr.psfu"
baseUpdateSysConfig /etc/sysconfig/console CONSOLE_SCREENMAP trivial
baseUpdateSysConfig /etc/sysconfig/console CONSOLE_MAGIC "(K"
baseUpdateSysConfig /etc/sysconfig/console CONSOLE_ENCODING "UTF-8"

baseUpdateSysConfig /etc/sysconfig/windowmanager X_MOUSE_CURSOR Adwaita
echo -e '\nXCURSOR_THEME=Adwaita' >> /etc/environment

[ "$desktop" = "x11" ] && displaymanager=sddm
baseUpdateSysConfig /etc/sysconfig/displaymanager DISPLAYMANAGER $displaymanager

[ "$desktop" = "x11" ] && windowmanager=lxqt
baseUpdateSysConfig /etc/sysconfig/windowmanager DEFAULT_WM $windowmanager

#Disable journal write to disk in live mode, bug 950999
echo "Storage=volatile" >> /etc/systemd/journald.conf

# Remove generated files (boo#1098535)
rm -rf /var/cache/zypp/* /var/lib/zypp/AnonymousUniqueId /var/lib/systemd/random-seed

#======================================>%
_USER="linux"
_HOME="/home/linux"
_ICON="breeze-dark"
_THEME_GTK="Breeze"
_STYLE="kvantum"
_THEME="system"
_THEME_OB="Arc-Dark"
_THEME_KV="KvCyan"
_SDDM_THEME="clairvoyance"
_WALLPAPER="/usr/share/wallpapers/openSUSEdefault/contents/images/1920x1080.jpg"
_SDDM_WALLPAPER="$_WALLPAPER"

cp /usr/share/sddm/themes/$_SDDM_THEME/theme.conf /usr/share/sddm/themes/$_SDDM_THEME/theme.conf.user
sed -i "s|\(background=\).*|\1$_SDDM_WALLPAPER|" /usr/share/sddm/themes/$_SDDM_THEME/theme.conf.user
if [ -f /usr/lib/sddm/sddm.conf.d/00-general.conf ]; then
    cat >> /usr/lib/sddm/sddm.conf.d/00-general.conf <<-EOF

[Theme]
Current=$_SDDM_THEME
CursorTheme=Adwaita
EOF
fi

#if [ -f /usr/share/lxqt/lxqt.conf ];then
#    install -Dm 0644 /usr/share/lxqt/lxqt.conf -t /etc/xdg/lxqt/
#fi
sed -i "s/^\(theme=\).*/\1$_THEME/" /etc/xdg/lxqt/lxqt.conf
sed -i "s/^\(icon_theme=\).*/\1$_ICON/" /etc/xdg/lxqt/lxqt.conf
sed -i "s/^\(style=\).*/\1$_STYLE/" /etc/xdg/lxqt/lxqt.conf
#if [ -f /usr/share/pcmanfm-qt/lxqt/settings.conf ]; then
#    install -Dm 0644 /usr/share/pcmanfm-qt/lxqt/settings.conf -t /etc/xdg/pcmanfm-qt/lxqt/
#fi
#sed -i '/^IconThemeName=/s/$/\nFallbackIconThemeName=oxygen/' \
#    /etc/xdg/pcmanfm-qt/lxqt/settings.conf
sed -i "s|^\(Wallpaper=\).*|\1$_WALLPAPER|" \
    /etc/xdg/pcmanfm-qt/lxqt/settings.conf

sed -i "s/\(gtk-icon-theme-name = \).*/\1\"$_ICON\"/" /etc/gtk-2.0/gtkrc
sed -i "s/\(gtk-icon-theme-name = \).*/\1$_ICON/" /etc/gtk-3.0/settings.ini
sed -i "s/\(gtk-theme-name = \).*/\1\"$_THEME_GTK\"/" /etc/gtk-2.0/gtkrc
sed -i "s/\(gtk-theme-name = \).*/\1$_THEME_GTK/" /etc/gtk-3.0/settings.ini

if [ -d /usr/share/themes/$_THEME_OB ]; then
    sed -i "s/Clearlooks/$_THEME_OB/" /etc/xdg/openbox/rc.xml
    sed -i "s/Onyx/$_THEME_OB/" /etc/xdg/openbox/lxqt-rc.xml
fi

#if [ -f /usr/share/lxqt/panel.conf ]; then
#    install -Dm 0644 /usr/share/lxqt/panel.conf -t /etc/xdg/lxqt/
#fi
#sed -i -e '/\[quicklaunch\]/s|$|\napps\\1\\desktop=/usr/share/applications/pcmanfm-qt.desktop|' \
#    -e '/\[quicklaunch\]/s|$|\napps\\2\\desktop=/usr/share/applications/qterminal.desktop|' \
#    -e '/\[quicklaunch\]/s|$|\napps\\size=2|' \
#    /etc/xdg/lxqt/panel.conf
#sed -i '/type=mainmenu/s/^/alignment=Left\nownIcon=true\nshowText=true\ntext=openSUSE\n/' \
#    /etc/xdg/lxqt/panel.conf
#sed -i '/plugins=/s/\(volume,\)/kbindicator,\1/' /etc/xdg/lxqt/panel.conf
#cat >> /etc/xdg/lxqt/panel.conf <<-EOF
#
#[kbindicator]
#alignment=Right
#show_caps_lock=false
#show_num_lock=false
#show_scroll_lock=false
#show_layout=true
#keeper_type=global
#type=kbindicator
#EOF
cat >> /etc/xdg/lxqt/globalkeyshortcuts.conf <<-EOF

[Alt%2BF11.9]
Comment=Skippy-XD
Enabled=true
Exec=skippy-xd
EOF
sed -i "/background = #/!s|^\(background =\).*|\1 $_WALLPAPER|" /etc/xdg/skippy-xd.rc
sed -i 's/^\(show = \).*/\1false/' /etc/xdg/skippy-xd.rc

#if [ -f /usr/share/lxqt/windowmanagers.conf ]; then
#    install -Dm 0644 /usr/share/lxqt/windowmanagers.conf -t /etc/xdg/lxqt/
#fi

if [ -f /etc/xdg/bl-exit/bl-exitrc ]; then
    menu="/etc/xdg/openbox/menu.xml"
    sed -i -e 's/Exit/Execute/' \
    -e '/prompt/s|yes|bl-exit|' \
    -e 's/prompt/command/g' $menu
    echo -e 'xscreensaver -no-splash &\nidesk &\ntint2 &\ncompton &\nnm-applet &\n' >> \
        /etc/xdg/openbox/autostart
    # blue, dark, darkred, grey, light, orange
    #sed -i 's/\(rcfile = \).*/\1dark\.rc/' /etc/xdg/bl-exit/bl-exitrc
    # bunsen-small, dark, light, minimal
    sed -i 's/\(theme = \).*/\1bunsen-small/' /etc/xdg/bl-exit/bl-exitrc
fi

echo -e '\nexport QT_QPA_PLATFORMTHEME=lxqt\nexport XDG_CURRENT_DESKTOP=LXQt' >> /etc/skel/.profile
cp /etc/skel/.profile /root/
cp /etc/skel/.profile $_HOME/.profile

mkdir -p $_HOME/Desktop
if [ -f "/usr/share/applications/org.kde.falkon.desktop" ]; then
    cp -f /usr/share/applications/org.kde.falkon.desktop $_HOME/Desktop/
fi

# Kvantum themes
if [ -f /etc/xdg/Kvantum/kvantum.kvconfig ]; then
sed -i "s/\(theme=\).*/\1$_THEME_KV/" /etc/xdg/Kvantum/kvantum.kvconfig
fi

if [ -f /etc/xdg/tint2/tint2rc ]; then
    sed -i 's/\(panel_background_id = \).*/\13/' /etc/xdg/tint2/tint2rc
fi

if [ -x /usr/bin/idesk ]; then
mkdir -p $_HOME/.idesktop
cat > $_HOME/.idesktop/falkon.lnk <<-EOF
table Icon
  Caption: Web Browser
  Command: /usr/bin/falkon
  Icon: /usr/share/icons/hicolor/48x48/apps/falkon.png
  Width: 48
  Height: 48
  X: 30
  Y: 30
end
EOF
cat > $_HOME/.ideskrc <<-EOF
table Config
  FontName: Droid Sans
  FontSize: 10
  FontColor: #d3dae3
  FontNameTip: Droid Sans
  FontSizeTip: 9
  ForeColorTip: #0000FF
  BackColorTip: #FFFFFF
  PaddingX: 10
  PaddingY: 10
  Transparency: 75
  HighContrast: true
  Locked: true
  Shadow: false
  ShadowColor: #0006FA
  ShadowX: 2
  ShadowY: 2
  SnapShadow: true
  IconSnap: true
  SnapWidth: 10
  SnapHeight: 10
  SnapOrigin: BottomRight
  SnapShadowTrans: 300
  CaptionOnHover: true
  Bold: true
  ToolTip.FontSize: 10
  ToolTip.FontName: Droid Sans
  ToolTip.ForeColor: #d3dae3
  ToolTip.BackColor: #5294e2
  ToolTip.CaptionOnHover: false
  ToolTip.CaptionPlacement: Right
  Background.Delay: 0
  Background.Source: $_HOME/.idesktop/icons
  Background.File: $_WALLPAPER
  Background.Mode: Scale
  Background.Color: #C2CCFF
end

table Actions
  Lock: control right doubleClk
  Reload: middle doubleClk
  Drag: left hold
  EndDrag: left singleClk
  Execute[0]: left doubleClk
  Execute[1]: right doubleClk
end
EOF
fi

chown -R $_USER:users $_HOME

chkstat --system --set

mkdir -p /etc/zypp/vendors.d
cat > /etc/zypp/vendors.d/packman <<-EOF
[main]
vendors = openSUSE,http://packman.links2linux.de
EOF
#======================================>%