desktop-base-openmamba/mambabase/mambabase.sh

277 lines
10 KiB
Bash
Raw Permalink Normal View History

2011-04-26 13:25:32 +02:00
# openmamba post installation script
# Copyright (c) 2007-2015 by Silvan Calarco <silvan.calarco@mambasoft.it>
2011-04-26 13:25:32 +02:00
#
# Released under the terms of the GNU GPLv3 License
VERSION=1.0
2011-04-26 13:25:32 +02:00
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 apt_get_parsed() {
sudo smart $@ | apt_parser
}
DCOPID=$2
echo $"\
openmamba installation script - version $VERSION
Copyright (c) 2007-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
2011-04-26 13:25:32 +02:00
"
[ "$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`
2011-04-26 13:25:32 +02:00
[ "$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`
2011-04-26 13:25:32 +02:00
[ "$DCOPID" ] && dcop $DCOPID KommanderIf setMaximum progressBar $TOTAL_PROGRESS
if [ "$INSTALL_BASE" = "1" ]; then
echo $"Installing openmamba base packages"
dcop_write $"Updating packages list..." 10
apt_get_parsed update
dcop_write $"Removing packages that are no longer needed..." 10
rpm -q msysklogd >/dev/null && apt_get_parsed remove -y msysklogd
dcop_write $"Installing/updating openmamba base packages..." 15
rpm -q --whatprovides $BASE_PKGS >/dev/null || apt_get_parsed install -y $BASE_PKGS
# first time: remove mambabase from autostart
2011-04-26 13:25:32 +02:00
[ -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
2011-04-26 13:25:32 +02:00
fi
if [ "$INSTALL_UPDATE" = "1" ]; then
echo $"Updating installed packages"
dcop_write $"Updating installed packages..." 15
apt_get_parsed upgrade -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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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 || apt_get_parsed 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
2011-04-26 13:25:32 +02:00
if [ "$INSTALL_FLASH" = "1" ]; then
echo $"Installing flash plugin"
dcop_write $"Installing Flash plugin..." 10
/usr/bin/openmamba-netsrpms flashplugin
2011-04-26 13:25:32 +02:00
echo $"Executing nspluginscan"
nspluginscan
rpm -q gnash && {
echo $"Removing gnash"
sudo rpm -e gnash
2011-04-26 13:25:32 +02:00
}
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
2011-04-26 13:25:32 +02:00
if [ "$INSTALL_CODECS" = "1" ]; then
echo $"Installing win32 codecs"
dcop_write $"Installing Win32 codecs..." 10
/usr/bin/openmamba-netsrpms win32codecs
2011-04-26 13:25:32 +02:00
fi
if [ "$INSTALL_MSTTCF" = "1" ]; then
dcop_write $"Installing MS TrueType core fonts..." 10
/usr/bin/openmamba-netsrpms msttcorefonts
2011-04-26 13:25:32 +02:00
fi
if [ "$INSTALL_SKYPE" = "1" ]; then
rpm -q libqt4 >/dev/null || apt_get_parsed install -y libqt4
dcop_write $"Installing Skype software..." 10
/usr/bin/openmamba-netsrpms skype
2011-04-26 13:25:32 +02:00
fi
if [ "$INSTALL_JAVA" = "1" ]; then
2016-09-13 13:07:01 +02:00
dcop_write $"Installing Oracle Java 8..." 10
/usr/bin/openmamba-netsrpms sun-java8
fi
2011-04-26 13:25:32 +02:00
if [ "$INSTALL_JRE" = "1" ]; then
2011-04-26 13:25:32 +02:00
dcop_write $"Installing Sun Java Runtime Environment..." 10
apt_get_parsed install -y $SUN_JAVA_RUNTIME_PKGS
fi
if [ "$INSTALL_JDK" = "1" ]; then
dcop_write $"Installing Sun Java Developers Kit..." 10
apt_get_parsed install -y $SUN_JAVA_PKGS
fi
2011-04-26 13:25:32 +02:00
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