armbian-build/lib/desktop.sh
Igor Pečovnik 1221d59233
Build all targets RFC (#1515)
* Introducing build-all-ng
* Implementing REBUILD_IMAGES='board1,board2,...' for rebuilding certain images only
* Add optimisations when building kernels - only cycle trough needed targets. Adding variable for defining whether an image is build, otherwise only BSP is made.
* repository manipulating RFC
* Add bianco deb file that is added by default if repository is clean
* Switch to gpg2 signing method, small bugfix
* Create subdir for debs and debs-beta
* Synaptic bugfix: installing indexing tools https://forum.armbian.com/topic/8021-orange-pi-one-synaptic-package-manager-search-very-slow/?do=findComment&comment=74918
* add all modules by default to Odroid N2, but leave them commented
* Bugfix: not making any builds when selecting kernel_only
* Remove EXTERNAL=yes ... move armbian-config and armbian-firmware into main compilation area, drop others since they are deprecated anyway. This will also enable multi threaded images making
* Move armbian.list to create_sources_list function. Replace NTP by Chrony. Remove armbian-firmware from PACKAGE_LIST and RockPi 4A (#1528)
* Replace NTP by chrony. Remove installion of outdated armbian-firmware from reposity.
* added RockPi 4A
* New format for board config
* Fix Bluetooth dependencies for minimal package - add rfkill to family related installs
* Moving networkd-dispatcher from minimal image
* Cubox-i: update default config
* Improving umount process
* Add purgesource feature
* Add FULL_DESKTOP to install few more applications on top of our desktop - notebooks should * rk3399 default: adjust patches and configuration
* Enable full desktop on most powerfull boards and notebooks

Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
2019-09-01 22:13:13 +02:00

132 lines
6.3 KiB
Bash

#!/bin/bash
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# This file is a part of the Armbian build script
# https://github.com/armbian/build/
create_desktop_package ()
{
# cleanup package list
PACKAGE_LIST_DESKTOP=${PACKAGE_LIST_DESKTOP// /,}; PACKAGE_LIST_DESKTOP=${PACKAGE_LIST_DESKTOP//[[:space:]]/}
PACKAGE_LIST_DESKTOP_RECOMMENDS=${PACKAGE_LIST_DESKTOP_RECOMMENDS// /,}; PACKAGE_LIST_DESKTOP_RECOMMENDS=${PACKAGE_LIST_DESKTOP_RECOMMENDS//[[:space:]]/}
local destination=${SRC}/.tmp/${RELEASE}/${BOARD}/${CHOSEN_DESKTOP}_${REVISION}_all
rm -rf "${destination}"
mkdir -p "${destination}"/DEBIAN
# set up control file
cat <<-EOF > "${destination}"/DEBIAN/control
Package: ${CHOSEN_DESKTOP}
Version: $REVISION
Architecture: all
Maintainer: $MAINTAINER <$MAINTAINERMAIL>
Installed-Size: 1
Section: xorg
Priority: optional
Depends: ${PACKAGE_LIST_DESKTOP//[:space:]+/,}
Recommends: ${PACKAGE_LIST_DESKTOP_RECOMMENDS//[:space:]+/,}
Provides: ${CHOSEN_DESKTOP}
Description: Armbian desktop for ${DISTRIBUTION} ${RELEASE}
EOF
cat <<-EOF > "${destination}"/DEBIAN/postinst
#!/bin/sh -e
# overwrite stock chromium and firefox configuration
if [ -d /etc/chromium-browser/ ]; then ln -sf /etc/armbian/chromium.conf /etc/chromium-browser/default; fi
if [ -d /etc/chromium.d/ ]; then ln -sf /etc/armbian/chromium.conf /etc/chromium.d/chromium.conf; fi
cp -R /etc/armbian/chromium /usr/share
# overwrite stock lightdm greeter configuration
if [ -d /etc/armbian/lightdm ]; then cp -R /etc/armbian/lightdm /etc/; fi
if [ -d /usr/lib/firefox-esr/ ]; then
ln -sf /etc/armbian/firefox.conf /usr/lib/firefox-esr/mozilla.cfg
echo 'pref("general.config.obscure_value", 0);' > /usr/lib/firefox-esr/defaults/pref/local-settings.js
echo 'pref("general.config.filename", "mozilla.cfg");' >> /usr/lib/firefox-esr/defaults/pref/local-settings.js
fi
# Adjust menu
sed -i -n '/<Menuname>Settings<\/Menuname>/{p;:a;N;/<Filename>xfce4-session-logout.desktop<\/Filename>/!ba;s/.*\n/\
\t<Separator\/>\n\t<Merge type="all"\/>\n <Separator\/>\n <Filename>armbian-donate.desktop<\/Filename>\
\n <Filename>armbian-support.desktop<\/Filename>\n/};p' /etc/xdg/menus/xfce-applications.menu
# Hide few items
if [ -f /usr/share/applications/display-im6.q16.desktop ]; then mv /usr/share/applications/display-im6.q16.desktop /usr/share/applications/display-im6.q16.desktop.hidden; fi
if [ -f /usr/share/applications/display-im6.desktop ]]; then mv /usr/share/applications/display-im6.desktop /usr/share/applications/display-im6.desktop.hidden; fi
if [ -f /usr/share/applications/vim.desktop ]]; then mv /usr/share/applications/vim.desktop /usr/share/applications/vim.desktop.hidden; fi
if [ -f /usr/share/applications/libreoffice-startcenter.desktop ]]; then mv /usr/share/applications/libreoffice-startcenter.desktop /usr/share/applications/libreoffice-startcenter.desktop.hidden; fi
# Disable Pulseaudio timer scheduling which does not work with sndhdmi driver
if [ -f /etc/pulse/default.pa ]; then sed "s/load-module module-udev-detect$/& tsched=0/g" -i /etc/pulse/default.pa; fi
exit 0
EOF
chmod 755 "${destination}"/DEBIAN/postinst
# add loading desktop splash service
mkdir -p "${destination}"/etc/systemd/system/
cp "${SRC}"/packages/blobs/desktop/desktop-splash/desktop-splash.service "${destination}"/etc/systemd/system/desktop-splash.service
# install optimized browser configurations
mkdir -p "${destination}"/etc/armbian
cp "${SRC}"/packages/blobs/desktop/chromium.conf "${destination}"/etc/armbian
cp "${SRC}"/packages/blobs/desktop/firefox.conf "${destination}"/etc/armbian
cp -R "${SRC}"/packages/blobs/desktop/chromium "${destination}"/etc/armbian
# install lightdm greeter
cp -R "${SRC}"/packages/blobs/desktop/lightdm "${destination}"/etc/armbian
# install default desktop settings
mkdir -p "${destination}"/etc/skel
cp -R "${SRC}"/packages/blobs/desktop/skel/. "${destination}"/etc/skel
# using different icon pack. Workaround due to this bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=867779
if [[ ${RELEASE} == bionic || ${RELEASE} == stretch || ${RELEASE} == buster || ${RELEASE} == disco ]]; then
sed -i 's/<property name="IconThemeName" type="string" value=".*$/<property name="IconThemeName" type="string" value="Humanity-Dark"\/>/g' \
"${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
fi
# install dedicated startup icons
mkdir -p "${destination}"/usr/share/pixmaps "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
cp "${SRC}/packages/blobs/desktop/icons/${DISTRIBUTION,,}.png" "${destination}"/usr/share/pixmaps
sed 's/xenial.png/'"${DISTRIBUTION,,}"'.png/' -i "${destination}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
# install logo for login screen
cp "${SRC}"/packages/blobs/desktop/icons/armbian.png "${destination}"/usr/share/pixmaps
# install wallpapers
mkdir -p "${destination}"/usr/share/backgrounds/xfce/
cp "${SRC}"/packages/blobs/desktop/wallpapers/armbian*.jpg "${destination}"/usr/share/backgrounds/xfce/
# create board DEB file
display_alert "Building desktop package" "${CHOSEN_DESKTOP}_${REVISION}_all" "info"
fakeroot dpkg-deb -b "${destination}" "${destination}.deb" >/dev/null
mkdir -p "${DEB_STORAGE}/${RELEASE}"
mv "${destination}.deb" "${DEB_STORAGE}/${RELEASE}"
# cleanup
rm -rf "${destination}"
}
desktop_postinstall ()
{
# disable display manager for first run
chroot "${SDCARD}" /bin/bash -c "systemctl --no-reload disable lightdm.service >/dev/null 2>&1"
[[ ${FULL_DESKTOP} == yes ]] && chroot "${SDCARD}" /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -yqq --no-install-recommends install $PACKAGE_LIST_DESKTOP_FULL" >> "${DEST}"/debug/install.log
# Compile Turbo Frame buffer for sunxi
if [[ $LINUXFAMILY == sun* && $BRANCH == default ]]; then
sed 's/name="use_compositing" type="bool" value="true"/name="use_compositing" type="bool" value="false"/' -i "${SDCARD}"/etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
# enable memory reservations
echo "disp_mem_reserves=on" >> "${SDCARD}"/boot/armbianEnv.txt
echo "extraargs=cma=96M" >> "${SDCARD}"/boot/armbianEnv.txt
fi
}