Topic: Script to install CFS on a minimal Ubuntu.
Hello all,
My Compiz Fusion Standalone (CFS) project is all going well, so I thought I'd lose all the messy config-leftovers from messing around and to ditch Gnome and the Ubuntu-desktop altogether; I was thinking of building CFS on a minimal Ubuntu install.
To make my life a little easier doing so, I've written a script that installs all the necessary packages including instructions on how to get CFS up and running. I thought I'd share this script with you, so others can benefit from it as well. (and so you can point out some things that I could improve of course, as my scripting skills aren't that good
)
EDIT: FIXED!
Oh, talking about my scripting skills; I have a question. The script makes an instructions file in my home directory, by
echo "blablabla" >> /home/jente/CFS/Instructions.txtIf I'm ever going to release the script, say on the Ubuntu forums, it would be nice to have a line prior to running the script in which the user has to type his/her username and that the line (>> /home/<user>/CFS/Instructions.txt) would be edited according to that entry. I think I have to do something with $user or something like that, but am not sure. Can you help me with that?
Last, but not least, the script:
#!/bin/bash
# A script written to set up a minimal Ubuntu install with a standalone Compiz Fusion session.
# You're free to check the script and modify it to suit your needs.
# Run this script as root (sudo ./cfs.sh)
#--------------------
clear
echo "Welcome to Unia's installation script."
echo ""
echo "This script is written to set up a minimal Ubuntu install with a standalone Compiz Fusion session. It will install all necessary packages to do so, including the basic applications you will need such as a browser, file manager and text editor. In order to do so, the script will add some repositories to your sources.list. See the intructions file in ~/CFS/Instructions.txt after this script has been run to see how to get CFS running properly. (nano ~/CFS/Instructions.txt)"
echo ""
echo -n "Do you want to run the script now? (Y|n) > "
read a
if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
[ "$a" = "" ]; then
#--------------------
# Repositories
#--------------------
clear
echo "Adding repositories..."
echo ""
sleep 1s
echo "No repositories added, as there currently are no repositories to be added. All software can be enabled through Ubuntu Tweak, which you'll have to install manually later. See the instructions file (nano ~/CFS/Instructions.txt)"
echo ""
sleep 1s
#--------------------
# Updates
#--------------------
clear
echo "Updating existing packages before continuing..."
echo ""
sleep 1s
apt-get dist-upgrade -y --force-yes
echo ""
echo "All existing packages updated."
echo ""
sleep 1s
#--------------------
# Base packages
#--------------------
clear
echo "Installing all required base packages..."
echo ""
sleep 1s
apt-get install xorg compiz fusion-icon emerald compizconfig-settings-manager gtk-window-decorator nitrogen lxappearance gksu gdebi software-store gdm openbox obconf obmenu nm-applet dmz-cursor-theme gtk2-engines-murrine gtk2-engines-aurora bash-completion cdbs dh-make debhelper libstdc++5 dkms build-essential gparted synaptic ttf-dejavu ntfs-3g ttf-freefont ttf-mscorefonts-installer jockey-gtk python-lxml libgtk2.0-dev libwnck-dev libdbus-1-dev git-core libdbus-glib-1-dev cpufrequtils lm-sensors
echo ""
echo "All base packages installed."
echo ""
sleep 1s
#--------------------
# File management
#--------------------
clear
echo "Installing all filemanagement applications..."
echo ""
sleep 1s
apt-get install file-roller rzip p7zip-full p7zip-rar
echo ""
echo "All filemanagement applications installed."
echo ""
sleep 1s
#--------------------
# Multimedia
#--------------------
clear
echo "Installing all multimedia applications..."
echo ""
sleep 1s
apt-get install vlc ubuntu-restricted-extras rhythmbox libgpod4 libgpod-common libusbmuxd1 usbmuxd libimobiledevice1 rhythmbox-plugins libplist1 rhythmbox-plugin-cdrecorder cheese agave eog brasero gimp shotwell gnome-screenshot
echo ""
echo "All multimedia applications installed."
echo ""
sleep 1s
#--------------------
# Internet
#--------------------
clear
echo "Installing all internet applications..."
echo ""
sleep 1s
apt-get install chromium-browser transmission-gtk emesene gftp
echo ""
echo "All internet applications installed."
echo ""
sleep 1s
#--------------------
# Office
#--------------------
clear
echo "Installing all office applications..."
echo ""
sleep 1s
apt-get install gedit gedit-plugins evince openoffice.org-writer openoffice.org-calc openoffice.org-gtk openoffice.org-math openoffice.org-impress
echo ""
echo "All office applications installed."
echo ""
sleep 1s
#--------------------
# Miscellaneous
#--------------------
clear
echo "Installing all miscellaneous packages..."
echo ""
sleep 1s
apt-get install gnome-calculator gnome-system-monitor xfce4-mixer xfce4-power-manager xfce4-power-manager-plugins xfce4-terminal gnome-screensaver
echo ""
echo "All miscellaneous packages installed."
echo ""
sleep 1s
#--------------------
# Clean
#--------------------
clear
echo "Cleaning cache..."
echo ""
sleep 1s
apt-get clean
echo ""
echo "Cache cleaned."
echo ""
sleep 1s
#--------------------
# Instructions.txt
#--------------------
clear
mkdir $HOME/CFS
echo "Welcome to the Compiz Fusion Standalone instructions file. This text file will explain to you how to properly set up your machine in order to be able to run CFS. You can achieve the same goal through other ways, but this is the only way I've tested. Only take other steps if you know what you're doing!" >> /home/jente/CFS/Instructions.txt
echo "--------------------" >> $HOME/CFS/Instructions.txt
echo "Firstly we'll have to create an xsession, so you can choose to run CFS from the Gnome Display Manager (GDM). To create the xsession, open up a terminal and run:
$ gksudo gedit /usr/share/xsessions/fusion.desktop
Now copy/paste this:
[Desktop Entry]
Encoding=UTF-8
# This is the name you'll see for the session in gdm
Name=Compiz
# This is the comment
Comment=Compiz Fusion Standalone
# The command
Exec=/usr/local/bin/start-fusion.sh
Type=Application
Safe the file and close gedit.
Some of you might've noticed the start-fusion script already. This script will launch the absolutely required applications, that you should not change unless you know what you're doing. To create the script, again open up a terminal and run:
$ gksudo gedit /usr/local/bin/start-fusion.sh
Copy/paste the following:
#!/bin/bash
## This is the top-level file for the Compiz Fusion Standalone session.
## This file contains all of the absolutely necessary files in order for a CFS session to run properly.
## Only edit this if you know what you're doing!
compiz ccp &
emerald & #edit to add: gtk-window-decorator is an option as well
fusion-icon &
/home/<user>/.config/compiz/autostart.sh
As you can see, the last line in the script points to another script in your home directory. This script contains all the user level packages, such as the panel, power manager, connection manager etcetera. Before creating this script, don't forget to edit the last line in start-fusion.sh according to your system. When you have done so, close gedit and make the file executable. Run this command:
$ sudo chmod +x /usr/local/bin/start-fusion.sh
The next step is to create the user level script. Again again, open up a terminal:
$ gedit ~/.config/compiz/autostart.sh
Again, copy/paste:
#!/bin/bash
## User-level autostart file for a Compiz Fusion Standalone session.
## This file is launced by /usr/local/bin/start-fusion.sh
#--------------
# Network manager
nm-applet &
# Wallpaper
nitrogen --restore &
# Panel
xfce4-panel &
# Power manager
xfce4-power-manager
If you want to add an application to this file (thus, having an application start on system boot), add another entry like this ABOVE THE POWER MANAGER ENTRY, otherwise your system won't boot:
# <Function/name, so you'll recognise the entry>
<command> &
Also, the '&' IS ABSOLUTELY NECESSARY! If you forget to add it, all entries underneath that one will not be started!
Now to enable the right-click root-menu. Open up your webbrowser (chromium-browser by default) and go to this website:
http://sourceforge.net/projects/compizboxmenu/
Download the .deb file and install it through Gdebi or the Software Center.
Now open up a filemanager and navigate to /etc/xdg/compiz/boxmenu/ and copy the menu.xml over to ~/.config/compiz/boxmenu/
Open CCSM and follow these steps to only make the menu pop up when you right-click on the desktop:
+ General Options > Commands > Commands > Command line 11 to 'compiz-boxmenu'
+ General Options > Commands > Button Bindings > Command 11 to 'button 3'
+ Desktop > Viewport Switcher > Desktop-based Viewport Switching > Plugin for initiate action to 'commands'
+ Desktop > Viewport Switcher > Desktop-based Viewport Switching > Action name for initiate to 'run_command11_key'
" >>$HOME/CFS/Instructions.txt
#--------------------
# Manual Applications
#--------------------
clear
echo "This file containts a list of applications you'll have to install manually, as they require third-party repositories / PPA's. In order to do this easily, open up a webbrowser and to go:
http://ubuntu-tweak.com/
Download Ubuntu Tweak, install it and run it.
Search for these applications and install them through Ubuntu Tweak:
+ Nautilus Elementary
+ Synapse
+ Google Earth
+ Virtualbox
Maybe's:
+gnome-system-tools
+gnome-mouse-properties
+gnome-display-properties
+gnome-keyboard-properties
+gnome-default-applications-properties
+gnome-system-log
+software-properties
+gnome-language-selector
+update-manager
+gnome-search-tool
+xfce4-panel 4.6
+seahorse
+computer-janitor
+checkbox
A volume manager
Also, don't forget to run sensors-detect and to set up cpufreq." >> $HOME/CFS/Applications.txt
#--------------------
# Reboot
#--------------------
clear
echo "Installation complete!"
echo "A reboot is required to run your newly installed system."
echo ""
echo -n "Reboot now? (Y|n) > "
read a
if [ "$a" = "y" ] || [ "$a" = "Y" ] || \
[ "$a" = "" ]; then
echo "When the system has rebooted, choose Openbox as your session. We will need Openbox in order to set up our system more easily. When you have booted, open up the instructions file found in ~/cfs.txt"
sleep 3s
shutdown -r now
exit
else
echo "Issue the following command to reboot:"
echo ""
echo " \$ sudo shutdown -r now"
echo ""
echo "When you reboot the system, choose Openbox as your session. We will need Openbox in order to set up our system more easily. When you have booted, open up the instructions file found in ~/cfs.txt"
sleep 3s
fi
fi
exitAlso, some miscellaneous applications have to be sorted out, but I placed them there as I'm not sure about them - there might be better alternatives. Same goes for the 'Maybe's' section in the Manual Application file.
Last edited by Unia (2011-02-18 20:14:01)