SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-02-18 16:44:43

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 3,704

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 wink)

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.txt

If 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
exit

Also, 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)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

Help fund CrunchBang, donate to the project!

#2 2011-02-18 18:03:15

aiBo
#! CrunchBanger
Registered: 2010-11-08
Posts: 236

Re: Script to install CFS on a minimal Ubuntu.

Hey, nice idea.

There is the enironment variable $HOME, which might help you:

$ echo $HOME
/home/aibo

Last edited by aiBo (2011-02-18 19:48:25)

Offline

#3 2011-02-18 19:15:44

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 3,704

Re: Script to install CFS on a minimal Ubuntu.

So I should place that on top, and then place $HOME instead of /home/<user>?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#4 2011-02-18 19:29:38

anonymous
The Mystery Member
From: Arch Linux Forums
Registered: 2008-11-29
Posts: 9,372

Re: Script to install CFS on a minimal Ubuntu.

You don't need to place anything at top. Just replace home/<user> with $HOME.

Offline

#5 2011-02-18 19:42:36

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 3,704

Re: Script to install CFS on a minimal Ubuntu.

Okidoki, I'll fix that as soon as I'm done with my backup big_smile


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#6 2011-02-18 20:23:44

Awebb
The Singularity
Registered: 2009-07-23
Posts: 2,812

Re: Script to install CFS on a minimal Ubuntu.

I have a list of compl... comments:

1. Why should I bother using a script when I have to add repos with a GUI tool like Ubuntu Tweak? Ubuntu Tweak pulls (when I last checked in) a bunch of Gnome dependencies we won't need here.
-> Add a version check for the running Ubuntu and implement the two different ways. If there is no need for repos, skip the Tweak part, it's more confusing and by the way absolutely irrelevant for the installation process.

2. You split the installation process, but you don't leave the user any control. You might argue that apt asks wether you want to install the given number of packages, but what if apt behaves differently all of a sudden? Are you positive that your script will continue under any circumstances after apt terminates for whatever reason?
-> Take the process of deciding wether you want to install the packages from those sections into your own hands. Ask the user in the script and force apt to install those packages (man apt-get if you don't know how).

3. Cleaning the cache just because you can is a bad habit. Others might have a different opinion, but automatically cleaning the cache will upset a lot of users.
-> Make it optional.

4. Scripts telling me to reboot are annoying. It is good to know, but noone really needs the script to automatically reboot. Tell the user to reboot, let him finish his work, he'll reboot... wait... why should he reboot? It should be enough to log out and in again... or maybe restart X11/GDM(SLIM etc.).

5. Why do you install openbox first, configure the system there and switch to compiz then? It's a script, you run it with sudo anyway. Just prepare the files for the user, echo/>>/tee them or create them in /tmp/cfs or something so the user can copy them over. Again: Why bother using a script, when I have to take a weird way aound another WM?

Short:
- Improve the control your script has over the events.
- Give the user some choice
- Don't split the installation steps just for the sake of design.
- don't reboot
- Let the script do all the work, don't create arbitrary paths over different GUI solutions.


I'm so meta, even this acronym

Offline

#7 2011-02-18 20:45:44

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 3,704

Re: Script to install CFS on a minimal Ubuntu.

Awebb wrote:

I have a list of compl... comments:

1. Why should I bother using a script when I have to add repos with a GUI tool like Ubuntu Tweak? Ubuntu Tweak pulls (when I last checked in) a bunch of Gnome dependencies we won't need here.
-> Add a version check for the running Ubuntu and implement the two different ways. If there is no need for repos, skip the Tweak part, it's more confusing and by the way absolutely irrelevant for the installation process.

Whilst that is true, I've mostly written this script for myself - including the steps I have taken to get my system to what it currently is. That part of the script is mostly a reminder for myself. The Ubuntu Tweak part could indeed be irrelevant to other users, but on the other hand I thought I should include it as it really is a nice tool and very handy for installing 'third party' applications such as Nautilus Elementary without to much hassle or terminal work - which is what most people prefer.

Awebb wrote:

2. You split the installation process, but you don't leave the user any control. You might argue that apt asks wether you want to install the given number of packages, but what if apt behaves differently all of a sudden? Are you positive that your script will continue under any circumstances after apt terminates for whatever reason?
-> Take the process of deciding wether you want to install the packages from those sections into your own hands. Ask the user in the script and force apt to install those packages (man apt-get if you don't know how).

Again, the script is first and foremost designed for myself. I know what packages I need and I know when to run the script and what I have to do when something goes wrong. If I'm ever going to release the script, I will certainly add other options (such as another browser) for the users. What options do you have for when apt decides to quit?

Awebb wrote:

3. Cleaning the cache just because you can is a bad habit. Others might have a different opinion, but automatically cleaning the cache will upset a lot of users.
-> Make it optional.

You might be right here. I thought it would be good to start with a clean cache after setting up the install. I will make this optional.

Awebb wrote:

4. Scripts telling me to reboot are annoying. It is good to know, but noone really needs the script to automatically reboot. Tell the user to reboot, let him finish his work, he'll reboot... wait... why should he reboot? It should be enough to log out and in again... or maybe restart X11/GDM(SLIM etc.).

After you do a minimal Ubuntu install, you have no X11/GDM so logging out and in or restarting GDM won't to the trick AFAIK. Whilst the line telling you to reboot might be annoying for you, it might be the right thing for users that aren't as good with Linux as you are.

Awebb wrote:

5. Why do you install openbox first, configure the system there and switch to compiz then? It's a script, you run it with sudo anyway. Just prepare the files for the user, echo/>>/tee them or create them in /tmp/cfs or something so the user can copy them over. Again: Why bother using a script, when I have to take a weird way aound another WM?

Again, copying the files from the instructions file to another file (the xsessions file, for example) is, imo, harder from CLI than it is from a GUI. Also, Openbox is installed as a backup might something go wrong with Compiz (which actually happened to me a couple of times. I messed up one of the scripts and found myself in a place where a backup WM is quite handy to restore things.)

Thanks for your feedback, I appreciate it and will use some of it to further improve the script.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#8 2011-02-19 13:44:51

Awebb
The Singularity
Registered: 2009-07-23
Posts: 2,812

Re: Script to install CFS on a minimal Ubuntu.

Unia wrote:

Thanks for your feedback, I appreciate it and will use some of it to further improve the script.

I'm glad to be of service.


I'm so meta, even this acronym

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo