Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- ### This script will install Mate desktop from EPEL repository
- # on a CentOS 7 system.
- # Optionaly, the "Gnome3 shell", "Gnome Classic desktop"
- # and gdm will be removed. In this case, the lightdm display
- # manager will be set as the default window manager.
- #
- #
- # Copyright 2014 by Yoram Gnat <yoram.gnat@gmail.com>
- # Published under GPL v2 License
- #
- # Note: Since this script may change the display session
- # ==== and display manager it should run at runlevel 3 (multiuser)
- # and not runlevel 5 (graphical user)
- #
- #================================================================
- ### Be sure we are at runlevel 3
- runlevel | grep 3 > /dev/null
- if [ "$?" != "0" ]; then
- echo "This script should run at level 3 (multiuser level)."
- echo "As root, type the command 'init 3' in a shell"
- echo "then, login as root and run this script again"
- exit 1
- fi
- #================================================================
- InstallX="false"
- RemoveG3="false"
- LightdmIsDefault="false"
- InstallCompiz="false"
- echo
- echo "Mate Desktop will be installed on your system."
- echo
- ### if X server is not installed we have the minimal installation and the
- # questions are irrelevant.
- rpm -q xorg-x11-server-Xorg > /dev/null
- if [ "$?" != "0" ]; then
- InstallX="true"
- LightdmIsDefault="true"
- ### else let's find what we should do
- else
- echo "Do you want to remove GNOME3 and Gnome Classic desktops "
- echo -n "after installing Mate ? (y/n)"
- read A
- if [ "$A" = "y" ]; then
- RemoveG3="true"
- LightdmIsDefault="true"
- else
- echo -n "Do you want to make lightdm the default window manager ? (y/n)"
- read A
- if [ "$A" = "y" ]; then
- LightdmIsDefault="true"
- fi
- fi
- fi
- #============================ Here we start =============================
- #
- ### Update the system
- echo
- echo "Updating System"
- echo
- yum -y update
- #==============================================================================
- #
- ### Enable extra repos (epel, nux-dextop and elrepo)for CentOS 7
- # EPEL
- if [ ! -f /etc/yum.repos.d/epel.repo ]; then
- rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
- fi
- # nux-dextop
- if [ ! -f /etc/yum.repos.d/nux-dextop.repo ]; then
- rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
- fi
- # ELREPO
- if [ ! -f /etc/yum.repos.d/elrepo.repo ]; then
- rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
- rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
- fi
- #==========================================================================
- # If we start with minimal system, we should install X
- # Since we do not want proprietary drivers at this stage, let's disable elrepo
- # Such drivers, eg. nvidia, can be installed later.
- if [ $InstallX = "true" ]; then
- yum -y --disablerepo=elrepo groupinstall "X Window System"
- fi
- #==========================================================================
- #
- ### Mate Desktop
- #
- yum -y groupinstall "MATE Desktop"
- ### Be sure we start at what was once called run level 5 (graphical user).
- systemctl set-default graphical.target
- ### Be sure caja is autostarting so that desktop icons will be visible
- #
- cat > /etc/xdg/autostart/caja-manage-desktop.desktop << EOF
- [Desktop Entry]
- Name=caja-manage-desktop.desktop
- GenericName=File Manager
- Exec=caja --no-default-window
- Icon=system-file-manager
- Terminal=false
- Type=Application
- StartupNotify=true
- NoDisplay=true
- OnlyShowIn=MATE;
- X-MATE-Bugzilla-Bugzilla=MATE
- X-MATE-Bugzilla-Product=caja
- X-MATE-Bugzilla-Component=general
- X-MATE-Bugzilla-Version=1.8.0
- X-MATE-Autostart-Phase=Desktop
- X-MATE-Autostart-Notify=true
- X-MATE-AutoRestart=true
- X-MATE-Provides=filemanager
- X-Desktop-File-Install-Version=0.21
- Name[en_US]=caja-manage-desktop.desktop
- EOF
- #==========================================================================
- #
- if [ "$RemoveG3" = "true" ]; then
- ### Remove gdm, Gnome3 shell and Gnome Classic
- yum -y remove \
- gdm \
- gnome-backgrounds gnome-boxes gnome-calculator \
- gnome-classic-session gnome-color-manager \
- gnome-contacts gnome-dictionary gnome-documents \
- gnome-font-viewer gnome-getting-started-docs \
- gnome-initial-setup gnome-packagekit gnome-shell \
- gnome-shell-extension* gnome-system-log gnome-terminal \
- gnome-tweak-tool gnome-video-effects gnome-weather \
- gnome-session nautilus*
- # just to be sure, remove definitions of old sessions if still there
- rm -f /usr/share/xsessions/*gnome*.desktop
- rm -f /usr/share/xsessions/*custom*.desktop
- fi
- #===============================================================================
- #
- if [ "$LightdmIsDefault" = "true" ]; then
- ### make lightdm the default display manager
- ln -sf /usr/lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
- fi
- #===================================================================================
- # Be sure some stuff we need is installed.
- # We need gcc and kernel-devel if we are a VirtualBox guest and want the
- # VirtualBox additions installed.
- # We need wget later in this script and if docky is installed, xdotool may be helpful.
- # Since the xdotool from EPEL won't install we will install the one from nux-dextop.
- # Luckily epel is not needed for the other stuff.
- yum -y --disablerepo=epel install gcc kernel-devel kernel-headers wget xdotool yumex && yum -y remove brasero rhythmbox totem evince* \
- eog empathy filezilla transmission* xchat ekiga \
- evolution* baobab abrt* gnome-system-monitor orca gedit \
- gnote file-roller gnome-screenshot gnome-clocks && yum -y update
- #==========================================================================
- #
- echo
- echo "Reboot the system now."
- echo
- echo "Have fun."
- echo
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement