Creating a script to install software after a clean install?

Solution 1:

Yes on all 3 questions.

Regarding the last question on settings: you can use package dconf-tools (included in the example) for a lot of them. And gconftool-2 for some others (though that latter one is phased out). I added one line at the bottom of the example. You can search for them like so gsettings list-recursively | grep plugins.power|more. This will show anything related to power settings.

If you need conditional commands you can use &&: {command && command2} will only issue command 2 if command 1 does not fail.


Create a text file and make it executable and add in exectable pieces of code. Example with some random things I do post install (that includes symlinking my home to a seperate disc (that does not get formatted when re-installing):

# Enable sources, add PPAs and update sources: 
sudo sed 's/# deb/deb/' -i /etc/apt/sources.list

sudo add-apt-repository ppa:tiheum/equinox
sudo add-apt-repository ppa:am-monkeyd/nautilus-elementary-ppa
sudo apt-get update
sudo apt-get upgrade

# Symlinking home folders.
cd /discworld2/
mkdir Desktop/ Downloads/ Pictures/ Videos/ Public/ Music/ Templates/ Documents/ 
cd
rm -rf Desktop/ Downloads/ Pictures/ Videos/ Public/ Music/ Templates/ Documents/ 
ln -s /discworld2/Desktop/   Desktop
ln -s /discworld2/Documents/ Documents
ln -s /discworld2/Downloads/ Downloads
ln -s /discworld2/Pictures/  Pictures
ln -s /discworld2/Templates/ Templates
ln -s /discworld2/Videos     Videos

# Adding software:
sudo apt-get install -y dconf-tools powertop htop compizconfig-settings-manager deluge vlc smplayer shutter chromium-browser cheese gtk2-engines-equinox faenza-icon-theme equinox-theme

# restart nautilus (req. to activate elementary):
nautilus -q

# remove lock screen

gsettings set org.gnome.desktop.screensaver lock-enabled false

# Altering settings power management (OLD method):

gconftool-2 --set --type string /apps/gnome-power-manager/critical_battery       shutdown 
gconftool-2 --set --type bool   /apps/gnome-power-manager/battery_reduce         false
gconftool-2 --set --type bool   /apps/gnome-power-manager/idle_dim_battery       false
gconftool-2 --set --type string /apps/gnome-power-manager/lid_ac                 blank
gconftool-2 --set --type string /apps/gnome-power-manager/lid_battery            blank
gconftool-2 --set --type string /apps/gnome-power-manager/sleep_computer_ac      0
gconftool-2 --set --type string /apps/gnome-power-manager/sleep_computer_battery 0
gconftool-2 --set --type string /apps/gnome-power-manager/power                  interactive

Solution 2:

You can use Ubuntu One to sync installed applications between computers. The option is available in the software-center menu.