Advertisement
Red-ex

Mate-desktop on Centos 7

Apr 20th, 2017
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.85 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. ### This script will install Mate desktop from EPEL repository
  4. #   on a CentOS 7 system.
  5. #   Optionaly, the "Gnome3 shell", "Gnome Classic desktop"
  6. #   and gdm will be removed. In this case, the lightdm display
  7. #   manager will be set as the default window manager.
  8. #
  9. #
  10. #   Copyright 2014 by Yoram Gnat <yoram.gnat@gmail.com>
  11. #   Published under GPL v2 License
  12. #
  13. #   Note: Since this script may change the display session
  14. #   ====  and display manager it should run at runlevel 3 (multiuser)
  15. #         and not runlevel 5 (graphical user)
  16. #
  17. #================================================================
  18. ### Be sure we are at runlevel 3
  19. runlevel | grep 3 > /dev/null
  20. if [ "$?" != "0" ]; then
  21.    echo "This script should run at level 3 (multiuser level)."
  22.    echo "As root, type the command 'init 3' in a shell"
  23.    echo "then, login as root and run this script again"
  24.    exit 1
  25. fi
  26. #================================================================
  27. InstallX="false"
  28. RemoveG3="false"
  29. LightdmIsDefault="false"
  30. InstallCompiz="false"
  31. echo
  32. echo "Mate Desktop will be installed on your system."
  33. echo
  34. ### if X server is not installed we have the minimal installation and the
  35. #   questions are irrelevant.
  36. rpm -q xorg-x11-server-Xorg > /dev/null
  37. if [ "$?" != "0" ]; then
  38.    InstallX="true"
  39.    LightdmIsDefault="true"
  40. ### else let's find what we should do
  41. else
  42.    echo "Do you want to remove GNOME3 and Gnome Classic desktops "
  43.    echo -n "after installing Mate ? (y/n)"
  44.    read A
  45.    if [ "$A" = "y" ]; then
  46.       RemoveG3="true"
  47.       LightdmIsDefault="true"
  48.    else
  49.       echo -n "Do you want to make lightdm the default window manager ? (y/n)"
  50.       read A
  51.       if [ "$A" = "y" ]; then
  52.          LightdmIsDefault="true"
  53.       fi
  54.    fi
  55. fi
  56. #============================ Here we start =============================
  57. #
  58. ### Update the system
  59. echo
  60. echo "Updating System"
  61. echo
  62. yum -y update
  63. #==============================================================================
  64. #
  65. ### Enable extra repos (epel, nux-dextop and elrepo)for CentOS 7
  66. # EPEL
  67. if [ ! -f /etc/yum.repos.d/epel.repo ]; then
  68.    rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
  69. fi
  70. # nux-dextop
  71. if [ ! -f /etc/yum.repos.d/nux-dextop.repo ]; then
  72.    rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
  73. fi
  74. # ELREPO
  75. if [ ! -f /etc/yum.repos.d/elrepo.repo ]; then
  76.    rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  77.    rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
  78. fi
  79. #==========================================================================
  80. # If we start with minimal system, we should install X
  81. # Since we do not want proprietary drivers at this stage, let's disable elrepo
  82. # Such drivers, eg. nvidia, can be installed later.
  83. if [ $InstallX = "true" ]; then
  84.    yum -y --disablerepo=elrepo groupinstall "X Window System"
  85. fi
  86. #==========================================================================
  87. #
  88. ### Mate Desktop
  89. #
  90. yum -y groupinstall "MATE Desktop"
  91. ### Be sure we start at what was once called run level 5 (graphical user).
  92. systemctl set-default graphical.target
  93. ### Be sure caja is autostarting so that desktop icons will be visible
  94. #
  95. cat > /etc/xdg/autostart/caja-manage-desktop.desktop << EOF
  96. [Desktop Entry]
  97. Name=caja-manage-desktop.desktop
  98. GenericName=File Manager
  99. Exec=caja --no-default-window
  100. Icon=system-file-manager
  101. Terminal=false
  102. Type=Application
  103. StartupNotify=true
  104. NoDisplay=true
  105. OnlyShowIn=MATE;
  106. X-MATE-Bugzilla-Bugzilla=MATE
  107. X-MATE-Bugzilla-Product=caja
  108. X-MATE-Bugzilla-Component=general
  109. X-MATE-Bugzilla-Version=1.8.0
  110. X-MATE-Autostart-Phase=Desktop
  111. X-MATE-Autostart-Notify=true
  112. X-MATE-AutoRestart=true
  113. X-MATE-Provides=filemanager
  114. X-Desktop-File-Install-Version=0.21
  115. Name[en_US]=caja-manage-desktop.desktop
  116. EOF
  117. #==========================================================================
  118. #
  119. if [ "$RemoveG3" = "true" ]; then
  120.    ### Remove gdm, Gnome3 shell and Gnome Classic
  121.    yum -y remove \
  122.       gdm \
  123.       gnome-backgrounds gnome-boxes gnome-calculator \
  124.       gnome-classic-session gnome-color-manager \
  125.       gnome-contacts gnome-dictionary gnome-documents \
  126.       gnome-font-viewer gnome-getting-started-docs \
  127.       gnome-initial-setup gnome-packagekit gnome-shell \
  128.       gnome-shell-extension* gnome-system-log gnome-terminal \
  129.       gnome-tweak-tool gnome-video-effects gnome-weather \
  130.       gnome-session nautilus*
  131.       # just to be sure, remove definitions of old sessions if still there
  132.       rm -f /usr/share/xsessions/*gnome*.desktop
  133.       rm -f /usr/share/xsessions/*custom*.desktop
  134. fi
  135. #===============================================================================
  136. #
  137. if [ "$LightdmIsDefault" = "true" ]; then
  138.       ### make lightdm the default display manager
  139.       ln -sf /usr/lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service
  140. fi
  141. #===================================================================================
  142. #  Be sure some stuff we need is installed.
  143. #  We need gcc and kernel-devel if we are a VirtualBox guest and want the
  144. #  VirtualBox additions installed.
  145. #  We need wget later in this script and if docky is installed, xdotool may be helpful.
  146. #  Since the xdotool from EPEL won't install we will install the one from nux-dextop.
  147. #  Luckily epel is not needed for the other stuff.
  148.    yum -y --disablerepo=epel install  gcc kernel-devel kernel-headers wget xdotool yumex && yum -y remove brasero rhythmbox totem evince* \
  149.       eog empathy filezilla transmission* xchat  ekiga \
  150.       evolution* baobab abrt* gnome-system-monitor orca gedit \
  151.       gnote file-roller gnome-screenshot gnome-clocks && yum -y update
  152. #==========================================================================
  153. #
  154. echo
  155. echo "Reboot the system now."
  156. echo
  157. echo "Have fun."
  158. echo
  159. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement