Code:
#!/bin/bash
################################################################################
# This script is a complete rewrite based on a script found on this site:
# Ubuntu TIP: Automating Package Installation – apt-get to the rescue
# http://tech.shantanugoel.com/2008/03/06/
# ubuntu-tip-automating-package-installation-%E2%80%93-apt-get-to-the-rescue.html
################################################################################
################################################################################
# Initialise variables and arrays...
################################################################################
version_number="0.41"
essid=""
network_password=""
nas_name=""
nas_sharename=""
nas_username=""
nas_password=""
username=""
packageslist=$(cat <<"EOF"
# gnome-do / Avant Window Navigator / DockbarX ??
# Check out the following: Handbrake Bluetooth Manager Mobile phone manager apache
#*** Extras
ubuntu-restricted-extras - Commonly used restricted packages
msttcorefonts - MS fonts
#***Preferences
compizconfig-settings-manager - Compiz configuration settings manager
hardinfo - UNIX/Linux hardware information
gsynaptics - for touchpad controls
compiz - pretty window manager
fusion-icon - icons?
emerald
nvidia-settings - Tool of configuring the NVIDIA graphics driver
#***Administration
#firestarter - gtk program for managing and observing your firewall
gparted - GNOME partition editor
#uck - ubuntu customisation kit (ADDED THROUGH PPA) dont need gfxboot-dev with PPA
#***Accessories
acetoneiso - an application to mount different images
mdf2iso - convert mdf files to ISO files
bchunk - convert bin and cue files into iso
unrar-free - to Extract RAR files
unace - extract ACE files
lzma - another archive method
#***Accessories - Text
gedit - another GUI text editor
vim - terminal text editor
#***Graphics
#blender - 3d Graphics application
gimp - The GNU Image Manipulation Program
inkscape - vector graphics drawing application
##***Internet
chromium-browser
links - text based browser
deluge - Torrent client
#***Office
#openoffice.org
#***Programming
#meld - graphical tool to diff and merge files
#regexxer - A visual search and replace tool
#monodevelop - nice IDE for common languages
#g++
#***Sound & Video - Player
vlc - multimedia player and streamer
#***Sound & Video - DVD
#audacity - A fast, cross-platform audio editor
#avidemux - a free video editor - gtk version
#dvdrip - perl front end for transcode
#padevchooser - PulseAudio Device Chooser
#pavumeter - PulseAudio Volume Meter
#***System Tools
#sysinfo - UNIX/Linux system information (MONO)
nautilus-gksu - privilege granting extension for nautilus using gksu - Open as Administrator
nautilus-open-terminal - nautilus plugin for opening terminals in arbitrary local paths
gconf-editor - An editor for the GConf configuration system
samba - a LanManager-like file and printer server for Unix
openssh-server - SSH server
openssh-client - SSH client
nmap - port scanning util
traceroute - server return info
wine - windows under linux
aptitude - package installer
dkms
googlecl - google docs command line interface
conky - system monitoring
glipper - clipboard manager, stops anoying loss of copy paste items, remember to add to taskbar to enable
xdotool - required for windows aero style snapping
wmctrl - required for windows aero style snapping
dnotify - dnotify -r *directory name* monitors files in directory
#***Aesthetics
gvfs-bin
EOF
)
removalpackageslist=$(cat <<"EOF"
firefox
gnomine
tomboy
totem
gwibber
quadrapassel
transmission-common
rhythmbox
gnome-dictionary
aisleriot
gbrainy
gnome-sudoku
#screenlets
shotwell
simple-scan
empathy
vinagre
pitivi
openoffice.org-core
#evolution
#evolution-common
#evolution-webcal
#evolution-indicator
#evolution-data-server
#evolution-data-server
#evolution-data-server-common
EOF
)
gameslist=$(cat <<"EOF"
#ufoai - UFO Alien invasion
playonlinux - Application to allow installation of windows games
uqm - ur quan masters
pokerth - texas holdem poker
dosbox - emulator for old pc games
#zsnes - snes emulator WHY WONT THIS INSTALL!?!?!?!?!
#scummvm - adventure emulator for lucasarts games
#neverball - mouse ball game
#frozen-bubble - like puzzle bobble
#pingus - lemmings clone
#xmoto - like old pc game moto
#glest
#foobillard - virtual pool
#mupen64plus - nintendo 64 emulator
#gfceu - snes emulator
#xmame-common
#snes9x-x
#gbrainy - brain training
#scorched3d - scortched earth in 3d
#chromium-bsu - too hard!
#yofrankie - doesnt run on liveUSB/CD
EOF
)
conkyrc=$(cat <<"EOF"
# UBUNTU-CONKY
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer right
# Use Xft?
use_xft yes
xftfont DejaVu Sans:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_interval 2.0
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 3
# border width
border_width 10
# Default colors and also border colors, grey90 == #e5e5e5
default_color black
own_window_colour ff0000
own_window_transparent yes
# Text alignment, other possible values are commented
alignment top_right
# Gap between borders of screen and text
gap_x 10
gap_y 10
#stuff after 'TEXT' will be formatted on screen
TEXT
$color
${color #fff000}SYSTEM ${hr 2}$color
$sysname $kernel on $machine $alignr $nodename
${font}Update: $alignr ${execi 600 aptitude search "~U" | wc -l | tail} package(s)
${font}Uptime: $alignr ${uptime}
${font}Time: $alignr $time
${font}Processes: $alignr $processes ($running_processes active)
${color #fff000}CPU / MEMORY / DISK ${hr 2}$color
${color #fff000}CPU: ${color }${freq}Hz ${acpitemp}°c ${cpu cpu1}% $alignr ${cpugraph cpu1 8,60}
${color #fff000}RAM: ${color } $mem/$memmax $memperc% $alignr ${memgraph 8,60}
${color #fff000}SWAP: ${color }$swapperc% $swap/$swapmax $alignr ${swapbar 8,60}
${color #fff000}ROOT: ${color }${fs_free /}/${fs_size /}$alignr ${fs_bar 8,60 /}
${color #fff000}HOME: ${color }${fs_free /home}/${fs_size /home}$alignr ${fs_bar 8,60 /home}
${color #fff000}NAME $alignr PID CPU MEM${color}
${top name 1} $alignr ${top pid 1} ${top cpu 1} ${top mem 1}
${top name 2} $alignr ${top pid 2} ${top cpu 2} ${top mem 2}
${top name 3} $alignr ${top pid 3} ${top cpu 3} ${top mem 3}
${top name 4} $alignr ${top pid 4} ${top cpu 4} ${top mem 4}
${top name 5} $alignr ${top pid 5} ${top cpu 5} ${top mem 5}
${color #fff000}NETWORK ${hr 2}$color
Public: ${alignr}${execi 900 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'}
Top net process: ${alignr}${execi 30 netstat -ept | grep ESTAB | awk '{print $9}' | cut -d: -f1 | sort | uniq -c | sort -nr}
${if_existing /sys/class/net/eth0/operstate up}IP (eth0):$alignr${addr eth0}
Down: ${downspeed eth0} k/s ${alignr}Up: ${upspeed eth0} k/s
${downspeedgraph eth0 8,60 } ${alignr}${upspeedgraph eth0 8,60 }
Total: ${totaldown eth0} ${alignr}Total: ${totalup eth0}
${endif}${if_existing /sys/class/net/eth1/operstate up}IP (eth1):$alignr${addr eth1}
Down: ${downspeed eth1} k/s ${alignr}Up: ${upspeed eth1} k/s
${downspeedgraph eth1 8,60} ${alignr}${upspeedgraph eth1 8,60}
Total: ${totaldown eth1} ${alignr}Total: ${totalup eth1}
${endif}${if_existing /sys/class/net/eth2/operstate up}IP (eth2):$alignr${addr eth2}
Down: ${downspeed eth2} k/s ${alignr}Up: ${upspeed eth2} k/s
${downspeedgraph eth2 8,60 } ${alignr}${upspeedgraph eth2 8,60 }
Total: ${totaldown eth2} ${alignr}Total: ${totalup eth2}
${endif}${if_existing /sys/class/net/wlan0/operstate up}IP (wlan0):$alignr${addr wlan0}
Down: ${downspeed wlan0} k/s ${alignr}Up: ${upspeed wlan0} k/s
${downspeedgraph wlan0 8,60 } ${alignr}${upspeedgraph wlan0 8,60 }
Total: ${totaldown wlan0} ${alignr}Total: ${totalup wlan0}
${endif}${if_existing /sys/class/net/ppp0/operstate}IP (ppp0):$alignr${addr ppp0}
Down: ${downspeed ppp0} k/s ${alignr}Up: ${upspeed ppp0} k/s
${downspeedgraph ppp0 8,60 } ${alignr}${upspeedgraph ppp0 8,60 }
Total: ${totaldown ppp0} ${alignr}Total: ${totalup ppp0}
${endif}
${color #fff000}LOGGING ${hr 2}$color
${execi 30 tail -n3 /var/log/messages | awk '{print " ",$5,$6,$7,$8,$9,$10}' | fold -w50}
EOF
)
backgroundimage=$(cat <<"EOF"
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="1000" height="1000" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<text x="700" y="700">versionnumber</text>
<path style="fill:#000000" transform="translate(-80,-500) scale(2)"
d="m 270,585 c -3.5,-1.6 -8,-3.5 -10.5,-4 -4.6,-1.2 -18.2,-8.4 -23.7,-12.6 -2,-1.5 -6.5,-4.9 -10,-7.6 -3.4,-2.5 -7.7,-5.4 -9.3,-6.1 -1.6,-0.7 -3.8,-2.2 -4.8,-3.3 -1,-1.1 -3.7,-2.9 -5.9,-4 -6.3,-3 -13.8,-11.1 -19.4,-20.8 -4,-7 -5.4,-10.7 -7.1,-18.7 -1.1,-5.4 -2.4,-12.1 -3,-14.7 -1.9,-3.2 -2.3,-10 -2.3,-15.7 0.5,-25.9 5.3,-43.7 13.1,-66.4 7.9,-21.1 21,-30 31.2,-46.6 C 222.5,357.3 243,346.8 251.2,342.8 c 3.7,-1.8 7.9,-2.7 15.3,-3.4 5.5,-0.5 13,-1.4 16.5,-1.9 4.1,-0.6 8.3,-0.6 12.3,0 3.2,0.5 8,0.9 10.6,0.9 23,3.2 39.0,11.7 56.6,28.2 9.8,9.1 16.1,12.5 26.8,28.3 14.5,18.7 18.9,43.7 18.8,59.2 -0.3,18.8 3.7,27.1 -0.2,40.4 -2.6,16.6 -9.2,25.9 -18.7,39.1 -1.3,1.8 -4.1,4.4 -6.2,5.8 -2,1.4 -5.3,4 -7.3,5.7 -1.9,1.7 -4.9,4.2 -6.7,5.4 -1.7,1.2 -5.2,5 -7.7,8.5 -4.2,5.8 -4.9,6.4 -9.7,7.4 -3.1,0.6 -7.3,2.6 -10.7,5 -9.8,7 -17.4,10 -29,11.6 -5.7,0.7 -12.7,2 -15.5,2.8 -2.7,0.8 -8.6,1.4 -13,1.4 -6.5,0 -8.9,-0.5 -14.2,-2.9 z m 19.2,-7.5 c 2.6,-1 1.8,-2.5 -4.5,-9.3 -3.3,-3.5 -7.2,-8.3 -8.7,-10.6 -3.2,-5.1 -10.2,-10.4 -20.4,-15.7 -4.3,-2.2 -9.7,-5 -12,-6.2 -2.2,-1.2 -7,-3.4 -10.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-1.8,-1.1 -6.4,1.4 -8.3,4.6 -4.2,7.2 3.1,16.3 7.8,9.6 z m 86.6,-0.2 c -7.9,-2.7 -10.9,-13.6 -7.5,-27.1 1.6,-6.3 3.8,-8.9 10.7,-12.5 7.8,-4.1 14.5,-1.9 22.1,6.9 4.3,5 4.5,5.6 4.5,11.5 0,6.5 -2.2,12.8 -5.6,15.8 -5.3,4.7 -18,7.5 -24.2,5.3 z m 13.2,-14.4 c 2.5,-3.4 3.8,-6 3.8,-8.2 0,-3.4 -0.1,-3.4 -6.7,-0.9 -5.7,2.1 -8,8.2 -4.6,12 2.4,2.7 3.5,2.2 7.6,-3 z M 340.7,459 c 0.9,-0.7 0.9,-1.3 0.1,-2.3 -1.4,-1.7 -2.2,-1.7 -4.9,0.4 -2.7,2.2 -1.8,4.5 1.3,3.5 1.1,-0.3 2.7,-1.1 3.4,-1.6 z m -1.3,-46.6 c -3.6,-2.2 -6.9,-5.8 -6,-6.7 0.7,-0.7 8.4,-3.6 15.4,-5.8 3.9,-1.2 4.4,-1.2 6.2,0.5 1,1 4.4,4.2 4.4,5.3 0,1.7 -3.1,0.5 -7.3,0.5 -5,0 -8.1,1.9 -8.1,5.2 0,2.5 -1.3,2.7 -4.5,0.8 z"/>
</svg>
EOF
)
menulist=$(cat <<"EOF"
default 4
timeout 10
color NORMAL HIGHLIGHT HELPTEXT HEADING
splashimage=/background_boot.xpm.gz
foreground=FFFFFF
background=000000
# Suggested by Erhan Sohail
title Boot First Hard Drive (HDD)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)
title Restart
reboot
title Shutdown
halt
title --- Custom MultiBoot Entries ---
root
title Ubuntu 10.10 (ubuntu vversionnumber)
find --set-root /ubuntu-10.10-desktop-amd64-versionnumber.iso
map /ubuntu-10.10-desktop-amd64-versionnumber.iso (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper persistent iso-scan/filename=/ubuntu-10.10-desktop-amd64-versionnumber.iso splash
initrd /casper/initrd.lz"
EOF
)
compizsnap=$(cat <<"EOF"
#!/bin/bash
##GENERAL INFORMATION###########################################################
# This script adds window snapping functionality to compiz using the commands plugin.
# CompizSnap LinuxUndIch.de Edition is a collaborative project from people from ubuntuforums.org
# and additions from LinuxUndIch. The script is licensed under GPL v3.
#
# Help and support:
# http://wwww.ubuntuforums.org/showthread.php?t=1294661
# http://linuxundich.de/de/ubuntu/aero-snap-mit-gnome-und-compiz/
##END OF HEAD###################################################################
# Check if necessary programs are installed
if [ -z $(command -v xdotool) ]; then
MISSING=xdotool
fi
if [ -z $(command -v wmctrl) ]; then
MISSING="wmctrl $MISSING"
fi
if [ ! -z "$MISSING" ]; then
echo
echo "Error (compizsnap):"
echo "You need to install the following program(s): $MISSING"
if [ -r /etc/debian_version ]
then
echo "In order to do so, run:"
echo "sudo apt-get install $MISSING"
fi
exit 1
fi
## End of check, script starts here
# Uncomment to get more output for troubleshooting
# Alternatively, run Compiz like this in the command line: 'VERBOSE=yes compiz'
#VERBOSE=yes
MOUSE=$(xinput -list | grep -i 'mouse' | grep -v 'Macintosh mouse button emulation' | grep id= | sed 's:.*id=\([0-9]*\).*:\1:')
TOUCHPAD=$(xinput -list | grep -i 'touchpad' | grep id= | sed 's:.*id=\([0-9]*\).*:\1:')
TRACKPAD=$(xinput -list | grep -i 'trackpoint' | grep id= | sed 's:.*id=\([0-9]*\).*:\1:')
WIDTH=$(xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x')
HEIGHT=$(xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 2 -d 'x' | cut -f 1 -d p)
HALF=$(($WIDTH/2-10))
TEMPWIDTH=$(($WIDTH-10))
left() {
#would be nicer, but --shell option works only under maverick
#eval $(xdotool getmouselocation --shell)
X=$(xdotool getmouselocation | awk '{print $1}' | cut -d : -f 2)
if [ $X -le 10 ]
then
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-10
fi
}
right() {
#eval $(xdotool getmouselocation --shell)
X=$(xdotool getmouselocation | awk '{print $1}' | cut -d : -f 2)
if [ $(($WIDTH-$X)) -le 10 ]
then
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -e 0,$HALF,0,$(($HALF+18)),-10
fi
}
max() {
#eval $(xdotool getmouselocation --shell)
Y=$(xdotool getmouselocation | awk '{print $2}' | cut -d : -f 2)
if [ $(($HEIGHT-$Y)) -ge $(($HEIGHT-$10)) ]
then
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
fi
}
if [ ! "$VERBOSE" = "yes" ]
then
QUIET=-q
fi
DEVICE=touchpad
loop() {
while (xinput --query-state $DEVICE_ID | grep $QUIET down)
do
if [ "$VERBOSE" = "yes" ]
then
echo "$DEVICE button pressed"
else
:
fi
done
}
# ----- Don't edit below this line unless you know what you are doing.
if [ -n "$MOUSE" ]
then
if xinput --query-state $MOUSE | grep $QUIET down
then
DEVICE_ID=$MOUSE
DEVICE=mouse
loop
$1 $MOUSE
fi
fi
if [ -n "$TOUCHPAD" ]
then
if xinput --query-state $TOUCHPAD | grep $QUIET down
then
DEVICE_ID=$TOUCHPAD
loop
$1 $TOUCHPAD
fi
fi
if [ -n "$TRACKPAD" ]
then
if xinput --query-state $TRACKPAD | grep $QUIET down
then
DEVICE_ID=$TRACKPAD
loop
$1 $TRACKPAD
fi
fi
EOF
)
################################################################################
# End of Initialisation of variables
################################################################################
customise () {
echo "--Creating conky script"
echo "${conkyrc}" > ~/.conkyrc
echo "--Creating background image"
backgroundimage=${backgroundimage//'versionnumber'/"$version_number"}
echo "${backgroundimage}" > /usr/share/backgrounds/background.svg
echo "--Adding Windows Aero snap style windows"
mkdir ~/.scripts
echo "${compizsnap}" > ~/.scripts/compizsnap.sh
echo "--Adding network settings"
sudo awk -v var="blah" '{ gsub(/dns mdns4/,"wins dns mdns4",$0); print }' /etc/nsswitch.conf > temp.conf
sudo mv temp.conf /etc/nsswitch.conf
echo "--Changing from default theme"
gconftool-2 --type string --set /desktop/gnome/interface/gtk_theme "Clearlooks"
gconftool-2 --type=string -s /apps/metacity/general/theme "Clearlooks"
gconftool-2 --type string --set /apps/metacity/general/button_layout ":minimize,maximize,close"
gconftool-2 --type string --set /desktop/gnome/interface/icon_theme "ubuntu"
echo "--Clearing desktop background"
gconftool-2 --type string --set /desktop/gnome/background/picture_options none
gconftool-2 --type string --set /desktop/gnome/background/color_shading_type "vertical-gradient"
gconftool-2 --type string --set /desktop/gnome/background/primary_color "#a987b673b90c"
gconftool-2 --type string --set /desktop/gnome/background/secondary_color "white"
gconftool-2 --type bool --set /apps/gnome-session/options/show_splash_screen false
echo "--Changing default background image"
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "/usr/share/backgrounds/background.svg"
gconftool-2 --type string --set /apps/gnome-session/options/splash_image "/usr/share/backgrounds/background.svg"
gconftool-2 --type string --set /desktop/gnome/background/picture_options "scaled"
echo "--Change nautilus to list view and change icon size"
gconftool-2 --type string --set /apps/nautilus/preferences/default_folder_viewer "list_view"
#gconftool-2 --type string --set /apps/nautilus/icon_view/default_zoom_level "smaller"
gconftool-2 --type string --set /apps/nautilus/preferences/side_pane_view "NautilusTreeSidebar"
echo "--Changing the default volume (e.g. the Ubuntu default is 6)"
gconftool-2 --set --type int /apps/gnome_settings_daemon/volume_step 2
echo "--Showing the mounted volumes as icons on the desktop"
gconftool-2 --set --type boolean /apps/nautilus/desktop/volumes_visible true
echo "--Enabling the check for full distribution update"
gconftool-2 --set --type boolean /apps/update-manager/check_dist_upgrades true
echo "--Disable screen dimming"
gconftool-2 --set --type boolean /apps/gnome-power-manager/backlight/idle_dim_ac false
gconftool-2 --set --type boolean /apps/gnome-power-manager/backlight/battery_reduce false
gconftool-2 --set --type boolean /apps/gnome-power-manager/backlight/idle_dim_battery false
gconftool-2 --set --type boolean /apps/gnome-power-manager/backlight/brightness_dim_battery "100"
echo "--Disable Power settings"
gconftool-2 --set --type boolean /apps/gnome-power-manager/actions/sleep_type_battery nothing
gconftool-2 --set --type boolean /apps/gnome-power-manager/actions/sleep_type_ac nothing
gconftool-2 --set --type boolean /apps/gnome-power-manager/backlight/idle_brightness "100"
echo "--Showing hidden files"
gconftool-2 --type boolean --set /desktop/gnome/file_views/show_hidden_files true
echo "--Making the DVD be played with VLC by default (instead of the Ubuntu default Totem player)"
gconftool-2 --type string --set /desktop/gnome/volume_manager/autoplay_dvd_command "gxine dvd:/%m"
gconftool-2 --type string --set /desktop/gnome/volume_manager/autoplay_dvd_command "vlc %m"
echo "--Disable ask before logoff"
gconftool-2 --type boolean --set /apps/gnome-session/options/logout_prompt false
echo "--Auto power off session when pressing power button"
gconftool-2 --type string --set /apps/gnome-power-manager/buttons/power "shutdown"
echo "--Disable screensaver lock"
gconftool-2 --type boolean --set /apps/gnome-screensaver/lock_enabled false
echo "--Disable autopopup of update manager"
gconftool-2 --type boolean --set /apps/update-notifier/auto_launch false
echo "--Disabling startup sound"
gconftool-2 --type bool --set /desktop/gnome/sound/event_sounds false
echo "--Enabling compiz plugins"
pluginlist2=$(gconftool-2 --get --list-type string /apps/compiz/general/allscreens/options/active_plugins)
checkcommands=$(echo "$pluginlist2" | grep commands)
if [[ ! $checkcommands ]]; then
pluginstoset=$(echo "$pluginlist2" | sed -e "s/]/\,commands]/")
gconftool-2 --set --type list --list-type string /apps/compiz/general/allscreens/options/active_plugins "$pluginstoset"
fi
echo "--Assigning the commands to the window borders"
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command0_edge "Left"
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command1_edge "Right"
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command2_edge "Top"
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command3_edge "Bottom"
echo "--Adding commands to metacity"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_1 "~/.scripts/compizsnap.sh left"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_2 "~/.scripts/compizsnap.sh right"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_3 "~/.scripts/compizsnap.sh top"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_4 "~/.scripts/compizsnap.sh bottom"
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command4_key "<Super>e"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_5 "nautilus" #Windows Logo+E (Open My Computer)
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command5_key "<Super>f"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_6 "gnome-search-tool" #Windows Logo+F (Search for a file or a folder)
gconftool-2 --set --type string /apps/compiz/plugins/commands/allscreens/options/run_command6_key "<Ctrl><Shift><Esc>"
gconftool-2 --set --type string /apps/metacity/keybinding_commands/command_7 "gnome-system-monitor" #CTRL+SHIFT+ESC (Open Task Manager)
gconftool-2 --set --type string /apps/metacity/global_keybindings/panel_main_menu "<Super>" #Windows Logo (Display or hide the Start menu)
gconftool-2 --set --type string /apps/metacity/global_keybindings/panel_run_dialog "<Super>r" #Windows Logo+R (Open the Run dialog box)
gconftool-2 --set --type string /apps/metacity/window_keybindings/toggle_maximised "<Alt>m" #Alt+m (Maximise window)
gconftool-2 --set --type string /apps/metacity/window_keybindings/toggle_fullscreen "<Alt><Enter>" #ALT+ENTER (View the properties for the selected item) / maximise/restore
#gconftool-2 --set --type string /apps/metacity/window_keybindings/minimize "<Alt>m" #Alt+M (Minimize window )
#gconftool-2 --set --type string /apps/metacity/window_keybindings/minimize "" #Windows Logo+SHIFT+M (Restore the minimized windows)
#single run configs:
echo "--Adding shortcuts to top panel"
#/usr/lib/gnome-panel/gnome-panel-add --launcher=/usr/share/applications/gnome-terminal.desktop --panel=top_panel_screen0 --right-stick
#/usr/lib/gnome-panel/gnome-panel-add --launcher=/usr/share/applications/chromium-browser.desktop --panel=top_panel_screen0 --right-stick
#/usr/lib/gnome-panel/gnome-panel-add --launcher=/usr/share/applications/gedit.desktop --panel=top_panel_screen0 --right-stick
echo "--Moving top panel to bottom"
#gconftool-2 --type string --set /apps/panel/toplevels/top_panel_screen0/orientation bottom
#end single run configs
}
extractaccompanyingdebpackages () {
clear
echo "--Adding PPA's..."
#download latest Win2-7 pak (windows 7 theme)
#wget http://lite.fr.nf./r-z
#mv r-z win7.lzma
echo "--Adding virtualbox to source list"
echo "--(Virtualbox OSE doesnt have USB support)"
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
sudo sh -c 'echo "#---added by me---\ndeb http://download.virtualbox.org/virtualbox/debian maverick contrib" >> /etc/apt/sources.list'
echo "--Adding wine PPA to source list"
sudo add-apt-repository ppa:ubuntu-wine/ppa
echo "--Adding uck PPA to source list"
sudo add-apt-repository ppa:uck-team/uck-stable
echo "--Updating source list"
sudo apt-get update
echo "--installing PPA's"
sudo apt-get install -y uck wine virtualbox-4.0
echo "--Extracting accompanying deb packages"
sudo dpkg -i -R *
echo -n "--Cleaning up (Removing packages after install)"
sudo rm *.deb
echo -n "--download dependencies for packages with missing dependencies"
sudo apt-get -f install
}
virtualboxdrivers () {
clear
echo "--Removing OSE drivers (installed by vbox) and reinstalling guest tools"
sudo apt-get remove -y virtualbox-4.0
sudo apt-get autoremove
sudo apt-get remove dkms
sudo apt-get install -y build-essential
echo "Remember to restart and install guest additions"
}
mountvirtualbox () {
clear
echo "--Modprobe virtualbox drivers"
sudo modprobe vboxdrv
echo "--Create mount point folder"
sudo mkdir /media/docs
echo "--Mounting default virtualbox shared folders"
sudo mount -t vboxsf -o uid=1000,gid=1000 docs /media/docs
}
beginremaster () {
clear
echo "--Beginning remaster"
sudo rm -rf ~/tmp/*
/usr/bin/uck-gui
#note that /usr/bin/uck has many options to start at different stages!
}
copyhostsettings () {
clear
echo "--Removing example content from host machine"
sudo rm -rf /usr/share/example-content/
echo "--Removing example content from remaster machine"
sudo rm ~/tmp/remaster-root/etc/skel/examples.desktop
echo "--Copying background image"
sudo cp /usr/share/backgrounds/background.svg ~/tmp/remaster-root/usr/share/backgrounds/background.svg
echo "--Copying desktop shortcuts"
sudo cp ~/Desktop/*.desktop ~/tmp/remaster-root/etc/skel/Desktop
echo "--Copying Desktop files and settings to remastered desktop"
sudo mkdir -p ~/tmp/remaster-root/etc/skel/Desktop/newinstall
sudo cp -R ~/Desktop/newinstall ~/tmp/remaster-root/etc/skel/Desktop
echo "--Copying compiz snap script"
sudo mkdir ~/tmp/remaster-root/etc/skel/.scripts
sudo cp ~/.scripts/compizsnap.sh ~/tmp/remaster-root/etc/skel/.scripts
echo "--Copying conky script"
sudo cp ~/.conkyrc ~/tmp/remaster-root/etc/skel/
echo "--Copying game files to correct install path"
#do this by finding what .iso files are accompanying the newinstall folder
sudo cp -R ~/Desktop/newinstall/games/quake ~/tmp/remaster-root/usr/share/games/
sudo cp -R ~/Desktop/newinstall/games/quake2 ~/tmp/remaster-root/usr/share/games/
sudo cp -R ~/Desktop/newinstall/games/yamagi-quake2 ~/tmp/remaster-root/usr/lib/games/
sudo cp ~/Desktop/newinstall/games/quake/quake.desktop ~/tmp/remaster-root/usr/share/applications/
sudo cp ~/Desktop/newinstall/games/quake2/quake2.desktop ~/tmp/remaster-root/usr/share/applications/
sudo cp ~/Desktop/newinstall/games/quake2/quake2_dedicated.desktop ~/tmp/remaster-root/usr/share/applications/
echo "--Removing game files from desktop of remaster"
sudo rm -rf ~/tmp/remaster-root/etc/skel/Desktop/newinstall/games
echo "--Copying user settings"
sudo cp -R ~/.gconf ~/tmp/remaster-root/etc/skel
}
postinstall () {
clear
# echo "--Disable login screen at bootup"
# this causes the live cd to stop at the login screen
# echo "
# TimedLoginEnable=false
# AutomaticLoginEnable=true
# TimedLogin=$username
# AutomaticLogin=$username
# TimedLoginDelay=30
# DefaultSession=gnome
# " > /etc/gdm/custom.conf
#echo "Downloading howto and post install script from google docs"
#cd ~/Desktop/
#google docs get --folder Linux .
echo "--Installing network drivers"
sudo apt-get --reinstall install bcmwl-kernel-source
sudo modprobe -r b43 ssb wl
sudo modprobe wl
echo "Connecting to home network - need to look into how to do this"
echo "--Sharing NAS storage device"
sudo mkdir /media/$nas_sharename
sudo mount -t smbfs -o username=$nas_username,password=$nas_password //$nas_name/$nas_sharename /media/$nas_sharename/
}
installpackages () {
clear
echo "--Uncomment multi and universe in sources list and update"
sudo sed -i -e "s/# deb/deb/g" /etc/apt/sources.list
sudo sh -c 'echo "#---added by me---\ndeb http://archive.getdeb.net/ubuntu maverick-getdeb games" >> /etc/apt/sources.list'
wget -q -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
sudo apt-get update
PACKAGE_NAME_LIST=""
PACKAGE_NAME_LIST=$(echo "${packageslist}"| grep -v -e "^#" | cut -f1 -d' ')
echo "Installing packages:" ${PACKAGE_NAME_LIST}
sudo apt-get install -y ${PACKAGE_NAME_LIST}
}
installgames () {
clear
GAMES_NAME_LIST=""
GAMES_NAME_LIST=$(echo "${gameslist}" | grep -v -e "^#" | cut -f1 -d' ')
echo "Installing games:" ${GAMES_NAME_LIST}
sudo apt-get install -y ${GAMES_NAME_LIST}
}
removepackages () {
clear
PACKAGE_REMOVAL_LIST=""
PACKAGE_REMOVAL_LIST=$(echo "${removalpackageslist}" | grep -v -e "^#" | cut -f1 -d' ')
echo "Removing packages:" ${PACKAGE_REMOVAL_LIST}
sudo apt-get remove -y ${PACKAGE_REMOVAL_LIST}
sudo apt-get autoremove
}
finishremaster () {
clear
mountvirtualbox ;
echo "--Moving remastered image to desktop version:" $version_number
sudo mv ~/tmp/remaster-new-files/livecd.iso ~/Desktop/ubuntu-10.10-desktop-amd64-$version_number.iso
sudo chmod 777 ~/Desktop/*.iso
echo "--Copying remastered image to My documents folder"
sudo cp ~/Desktop/ubuntu-10.10-desktop-amd64-$version_number.iso /media/docs/
echo "--Copying menu list to My documents folder"
menulist=${menulist//'versionnumber'/"$version_number"}
echo "${menulist}" > ~/Desktop/menu.lst
sudo cp ~/Desktop/menu.lst /media/docs/
echo "--Uploading customisation script to google docs"
google docs upload ~/Desktop/newinstall/installscript.sh --folder Linux
}
while : # Loop forever
do
cat << !
Remaster host Menu: Install order:
------------------------------------------------------------------------------
c. Customise desktop (theme, backgrounds etc ) 1
h. Copy host settings/files to remaster 3
b. Begin Remaster 2
f. Finish remaster (move remaster image to host) 8
-----------------------------------
From Chroot environment of Remaster
-----------------------------------
d. Download and extract proprietary packages 4
i. Install packages 5
g. Install games packages 6
r. Remove unwanted packages 7
-----------------------------------
Post install/boot
-----------------------------------
p. Post install script 9
v. Install virtual box guest additions on VM
m. Modprobe drivers and mount shared folders
q. Quit
!
echo -n " Your choice? : "
read choice
case $choice in
b) beginremaster ;;
h) copyhostsettings ;;
f) finishremaster ;;
c) customise ;;
d) extractaccompanyingdebpackages ;;
i) installpackages ;;
g) installgames ;;
r) removepackages ;;
p) postinstall ;;
v) virtualboxdrivers ;;
m) mountvirtualbox ;;
q|n|N|exit|quit)
echo ""
echo "Exiting..."
echo ""
exit 0;;
*) echo "\"$choice\" is not valid "; sleep 2 ;;
esac
done
Bookmarks