desktop-base-openmamba/mambabase/mambabase.sh

277 lines
10 KiB
Bash

# openmamba post installation script
# Copyright (c) 2007-2019 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPLv3 License
VERSION=1.0
TEXTDOMAIN=mambabase
TEXTDOMAINDIR=/opt/kde3/share/locale/
INSTALL_DATE=`date +%Y%m%d-%H%M`
INPUT_FILE=~/.mambabase.conf
LOG_FILE=/var/log/install-mamba-$INSTALL_DATE.log
KERNEL_RELEASE=`uname -r`
PROGRESS_POS=0
PKGGROUPS_DB=/usr/share/openmamba/pkggroups.db
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/mamba-tempfile
. $PKGGROUPS_DB
function dcop_write() {
[ "$DCOPID" ] && {
[ $2 = -1 ] &&
PROGRESS_POS=$TOTAL_PROGRESS ||
PROGRESS_POS=`expr $PROGRESS_POS + $2`
dcop $DCOPID KommanderIf setText progressText "$1"
dcop $DCOPID KommanderIf setText progressBar $PROGRESS_POS
}
}
function apt_parser() {
while read line; do
[ "$DCOPID" ] && {
echo $line
dcop $DCOPID KommanderIf setText progressText2 "$line"
}
done
}
[ "$1" = "-y" ] || {
echo $"Warning: this script will perform an automatic installation erasing all the"
echo $" contents of device $INSTALL_DEVICE; use $0 -y to actually start the"
echo $" operation."
exit 0
}
function pkg_tool() {
pkcon $@ | apt_parser
}
DCOPID=$2
echo $"\
openmamba installation script - version $VERSION
Copyright (c) 2007-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
"
[ "$DCOPID" ] && dcop $DCOPID KommanderIf setChecked NextBox false
dcop_write $"Starting installation..." 0
[ -r $INPUT_FILE ] || {
echo $"Error: cannot read input file $INPUT_FILE; aborting." >&2
abort
}
. $INPUT_FILE
TOTAL_PROGRESS=10
[ "$INSTALL_BASE" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 35`
[ "$INSTALL_UPDATE" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_OFFICE" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_PLAYERS" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_MULTIMEDIA_EDITING" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_INTERNET" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_GRAPHICS" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_GAMES" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_VIRTUALIZATION" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_SERVER" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_DEVEL" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 15`
[ "$INSTALL_FLASH" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_PEPPERFLASH" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_SKYPE" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_CODECS" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_MSTTCF" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_JAVA" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_NVIDIA" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_FGLRX" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_FGLRX_LEGACY" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_BROADCOM_STA" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_B43" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_SPOTIFY" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$INSTALL_VIRTUALBOX" = "1" ] && TOTAL_PROGRESS=`expr $TOTAL_PROGRESS + 10`
[ "$DCOPID" ] && dcop $DCOPID KommanderIf setMaximum progressBar $TOTAL_PROGRESS
if [ "$INSTALL_BASE" = "1" ]; then
echo $"Installing openmamba base packages"
dcop_write $"Updating packages list..." 10
pkg_tool update
dcop_write $"Removing packages that are no longer needed..." 10
rpm -q msysklogd >/dev/null && pkg_tool remove -y msysklogd
dcop_write $"Installing/updating openmamba base packages..." 15
rpm -q --whatprovides $BASE_PKGS >/dev/null || pkg_tool install -y $BASE_PKGS
# first time: remove mambabase from autostart
[ -e /home/$USER/.kde4/Autostart/mambabase.desktop ] && \
rm -f /home/$USER/.kde4/Autostart/mambabase.desktop
[ -e /home/$USER/.config/autostart/mambabase.desktop ] && \
rm -f /home/$USER/.config/autostart/mambabase.desktop
# ugly workaround: don't have permissions to rm file in /etc/xdg/autostart
[ -e /etc/xdg/autostart/mambabase.desktop ] && \
> /etc/xdg/autostart/mambabase.desktop
fi
if [ "$INSTALL_UPDATE" = "1" ]; then
echo $"Updating installed packages"
dcop_write $"Updating installed packages..." 15
pkg_tool update -y
fi
if [ "$INSTALL_OFFICE" = "1" ]; then
echo $"Installing Office packages"
dcop_write $"Installing/updating Office packages..." 15
rpm -q --whatprovides $OFFICE_PKGS >/dev/null || pkg_tool install -y $OFFICE_PKGS
fi
if [ "$INSTALL_PLAYERS" = "1" ]; then
echo $"Installing Audio and Video players"
dcop_write $"Installing/updating Audio and Video players..." 15
rpm -q --whatprovides $MULTIMEDIA_PLAYERS_PKGS >/dev/null || pkg_tool install -y $MULTIMEDIA_PLAYERS_PKGS
fi
if [ "$INSTALL_MULTIMEDIA_EDITING" = "1" ]; then
echo $"Installing multimedia editing and production packages"
dcop_write $"Installing/updating multimedia editing and production packages..." 15
rpm -q --whatprovides $MULTIMEDIA_EDITING_PKGS >/dev/null || pkg_tool install -y $MULTIMEDIA_EDITING_PKGS
fi
if [ "$INSTALL_INTERNET" = "1" ]; then
echo $"Installing Internet packages"
dcop_write $"Installing/updating Internet packages..." 15
rpm -q --whatprovides $INTERNET_PKGS >/dev/null || pkg_tool install -y $INTERNET_PKGS
fi
if [ "$INSTALL_GRAPHICS" = "1" ]; then
echo $"Installing Graphics packages"
dcop_write $"Installing/updating Graphics packages..." 15
rpm -q --whatprovides $GRAPHICS_PKGS >/dev/null || pkg_tool install -y $GRAPHICS_PKGS
fi
if [ "$INSTALL_GAMES" = "1" ]; then
echo $"Installing Games packages"
dcop_write $"Installing/updating Games packages..." 15
rpm -q --whatprovides $GAMES_PKGS >/dev/null || pkg_tool install -y $GAMES_PKGS
fi
if [ "$INSTALL_VIRTUALIZATION" = "1" ]; then
echo $"Installing Virtualization packages"
dcop_write $"Installing/updating Virtualization packages..." 15
rpm -q --whatprovides $VIRTUALIZATION_PKGS >/dev/null || pkg_tool install -y $VIRTUALIZATION_PKGS
fi
if [ "$INSTALL_SERVER" = "1" ]; then
echo $"Installing Server packages"
dcop_write $"Installing/updating Server packages..." 15
rpm -q --whatprovides $SERVER_PKGS >/dev/null || pkg_tool install -y $SERVER_PKGS
fi
if [ "$INSTALL_DEVEL" = "1" ]; then
echo $"Installing openmamba packages"
dcop_write $"Installing/updating Development packages..." 15
rpm -q --whatprovides $DEVEL_PKGS >/dev/null || pkg_tool install -y $DEVEL_PKGS
fi
if [ "$INSTALL_NVIDIA" = "1" ]; then
echo $"Installing NVIDIA proprietary video driver (autodetected) packages"
dcop_write $"Installing/updating NVIDIA proprietary video driver (autodetected) packages..." 10
NVIDIA_DETECTED=$(/sbin/nvidia-autoselect-driver | sed "s|.* ||")
rpm -q --whatprovides $NVIDIA_DETECTED >/dev/null || pkg_tool install -y $NVIDIA_DETECTED
fi
if [ "$INSTALL_FGLRX" = "1" ]; then
echo $"Installing AMD/ATI proprietary video driver packages"
dcop_write $"Installing/updating AMD/ATI proprietary video driver packages..." 10
rpm -q --whatprovides xorg-drv-video-fglrx >/dev/null || pkg_tool install -y xorg-drv-video-fglrx
fi
if [ "$INSTALL_FGLRX_LEGACY" = "1" ]; then
echo $"Installing AMD/ATI proprietary (legacy) video driver packages"
dcop_write $"Installing/updating AMD/ATI proprietary (legacy) video driver packages..." 10
rpm -q --whatprovides xorg-drv-video-fglrx-legacy >/dev/null || pkg_tool install -y xorg-drv-video-fglrx-legacy
fi
if [ "$INSTALL_BROADCOM_STA" = "1" ]; then
echo $"Installing Broadcom proprietary wireless driver"
dcop_write $"Installing Broadcom proprietary wireless driver..." 10
rpm -q --whatprovides broadcom-sta >/dev/null || pkg_tool install -y broadcom-sta
fi
if [ "$INSTALL_B43" = "1" ]; then
echo $"Installing Broadcom B43 proprietary firmware"
dcop_write $"Installing Broadcom B43 proprietary firmware..." 10
/usr/bin/openmamba-netsrpms b43-firmware
fi
if [ "$INSTALL_SPOTIFY" = "1" ]; then
echo $"Installing Spotify"
dcop_write $"Installing Spotify..." 10
/usr/bin/openmamba-netsrpms spotify
fi
if [ "$INSTALL_VIRTUALBOX" = "1" ]; then
echo $"Installing Virtualbox extension pack"
dcop_write $"Installing Virtualbox extension pack..." 10
/usr/bin/openmamba-netsrpms virtualbox-extension-pack
fi
if [ "$INSTALL_FLASH" = "1" ]; then
echo $"Installing flash plugin"
dcop_write $"Installing Flash plugin..." 10
/usr/bin/openmamba-netsrpms flashplugin
echo $"Executing nspluginscan"
nspluginscan
rpm -q gnash && {
echo $"Removing gnash"
sudo rpm -e gnash
}
fi
if [ "$INSTALL_PEPPERFLASH" = "1" ]; then
echo $"Installing pepper-flash plugin"
dcop_write $"Installing Pepper-Flash plugin..." 10
/usr/bin/openmamba-netsrpms chromium-pepper-flash
fi
if [ "$INSTALL_CODECS" = "1" ]; then
echo $"Installing win32 codecs"
dcop_write $"Installing Win32 codecs..." 10
/usr/bin/openmamba-netsrpms win32codecs
fi
if [ "$INSTALL_MSTTCF" = "1" ]; then
dcop_write $"Installing MS TrueType core fonts..." 10
/usr/bin/openmamba-netsrpms msttcorefonts
fi
if [ "$INSTALL_SKYPE" = "1" ]; then
rpm -q libqt4 >/dev/null || pkg_tool install -y libqt4
dcop_write $"Installing Skype software..." 10
/usr/bin/openmamba-netsrpms skype
fi
if [ "$INSTALL_JAVA" = "1" ]; then
dcop_write $"Installing Oracle Java..." 10
/usr/bin/openmamba-netsrpms sun-java
fi
if [ "$INSTALL_JRE" = "1" ]; then
dcop_write $"Installing Sun Java Runtime Environment..." 10
pkg_tool install -y $SUN_JAVA_RUNTIME_PKGS
fi
if [ "$INSTALL_JDK" = "1" ]; then
dcop_write $"Installing Sun Java Developers Kit..." 10
pkg_tool install -y $SUN_JAVA_PKGS
fi
dcop_write $"Installation completed." -1
[ "$DCOPID" ] && {
dcop $DCOPID KommanderIf setText progressText2 $"Press next to see the installation log and exit."
dcop $DCOPID KommanderIf setChecked NextBox true
}
echo $"Installation completed."
exit 0