Skip to content

Instantly share code, notes, and snippets.

@gburd
Created December 8, 2011 19:31
Show Gist options
  • Save gburd/1448186 to your computer and use it in GitHub Desktop.
Save gburd/1448186 to your computer and use it in GitHub Desktop.
Automate the install of X11 and Gnome2 on FreeBSD
#!/bin/sh
##################################################################
##################################################################
#
# The FreeBSD Easy Work Station Installation Script.
# David Childers - 15 Dec, 2009 / Updated 15 April, 2011
#
# This software is released under the Attribution-ShareAlike version 3.0 Licence.
# http://www.creativecommons.org/licenses/by-sa/3.0/
#
# From: http://www.scvi.net/freebsd/Desktop.txt
# If you find this script useful, please consider making a small donation.
# https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=10870717
#
##################################################################
##################################################################
#
# Portions of the script that are marked with bold face type require additional steps to be
# performed. If these additional steps are not completed, then the changes initiated by this
# script will not function properly.
#
##################################################################
##################################################################
#
# > If you modify the script, make absolutely sure that you use standard quotation marks '' '' and not word
# > processor quotation marks “ “ in elements that you use the echo function for adding entries to files.
# > Using word processor quotation marks ” “ inside the script will cause the script to not function
# > properly.
#
##################################################################
##################################################################
#
# It is advisable to begin with a fresh installation of FreeBSD.
#
# This script can be used with either an i386 or amd64 system.
#
##################################################################
##################################################################
#
echo "Updating the FreeBSD installation."
#
freebsd-update fetch
freebsd-update install
#
##################################################################
##################################################################
#
echo "Installing the ports tree."
#
portsnap fetch
portsnap extract
#
##################################################################
##################################################################
#
echo "Installing desktop software."
#
# X.Org complete distribution metaport.
#
pkg_add -r xorg
#
# The "meta-port" for the GNOME 2 integrated X11 desktop.
#
pkg_add -r gnome2
#
# The 'Geektoys' for the GNOME 2 power user.
#
pkg_add -r gnome2-power-tools
#
##################################################################
##################################################################
#
echo "Installing system utilities."
#
# Nano's ANOther editor, an enhanced free Pico clone. (Basic text editor – much better than Vi.)
#
pkg_add -r nano
#
# Allow others to run commands as root.
#
pkg_add -r sudo
#
# Midnight Commander, a free Norton Commander Clone.
#
pkg_add -r mc
#
##################################################################
##################################################################
#
echo "Installing printer utilities."
#
# Common UNIX Printing System: Metaport to install complete system.
#
pkg_add -r cups
#
# GutenPrint Printer Driver.
#
pkg_add -r gutenprint-cups
#
# Administration tool for cups (Gnome).
#
pkg_add -r gnome-cups-manager
#
##########
##########
##
## You may need to install additional device drivers for for specific printers.
##
## Drivers and utilities for HP Printers and All-in-One devices:
## # pkg_add -r hplip
##
## Printer listings
## www.openprinting.org/printers
##
## Printer driver listings
## www.openprinting.org/drivers
##
## Search for the printer you wish to install and download the correct ppd file.
##
## Install the ppd printer file using the cups web interface.
## This interface can be accessed from any web browser at this URL/address:
## http://localhost:631
##
##########
##########
#
echo "Enabling cups printing."
#
##########
##########
##
## You must manually edit these two individual files:
## (#indicates a typed command.)
##
## /usr/local/etc/cups/mime.types
## /usr/local/etc/cups/mime.convs
##
## # nano /usr/local/etc/cups/mime.types
## # nano /usr/local/etc/cups/mime.convs
##
## You must uncomment the following line contained in each file:
##
## application/octet-stream
##
## Remove the ; from the front of this line to uncomment it.
##
##########
##########
#
echo '[system=10]' >> /etc/devfs.rules
echo 'add path 'unlpt*' mode 0660 group cups' >> /etc/devfs.rules
echo 'add path 'ulpt*' mode 0660 group cups' >> /etc/devfs.rules
echo 'add path 'lpt*' mode 0660 group cups' >> /etc/devfs.rules
echo 'add path 'usb/X.Y.Z' mode 0660 group cups' >> /etc/devfs.rules
#
echo 'cupsd_enable="YES"' >> /etc/rc.conf
echo 'devfs_system_ruleset="system"' >> /etc/rc.conf
#
# Restart cups system.
#
/etc/rc.d/devfs restart
/usr/local/etc/rc.d/cupsd restart
#
# Reference:
# Configuring the CUPS Print Server
# www.freebsd.org/doc/en/articles/cups/printing-cups-configuring-server.html
#
##################################################################
##################################################################
#
echo "Configuring Gnome to automatically launch when the computer starts up."
#
# Starting with version 7.4, Xorg can use HAL to autodetect keyboards and mice. The sysutils/hal and
# devel/dbus ports are installed as dependencies of x11/xorg, but must be enabled by the following
# entries in the /etc/rc.conf file:
#
echo 'hald_enable="YES"' >> /etc/rc.conf
#
# Enabling Gnome start up.
#
echo 'gdm_enable="YES"' >> /etc/rc.conf
echo 'gnome_enable="YES"' >> /etc/rc.conf
echo 'dbus_enable="YES"' >> /etc/rc.conf
#
echo 'proc /proc procfs rw 0 0' >> /etc/fstab
#
# Reference:
# Desktop Environments
# www.freebsd.org/doc/en/books/handbook/x11-wm.html
#
# 5.4 X11 Configuration
# www.freebsd.org/doc/en/books/handbook/x-config.html
#
# FreeBSD GNOME Project: GNOME FAQ
# www.freebsd.org/gnome/docs/faq2.html
#
##################################################################
##################################################################
#
echo "Sound card configuration."
#
# This command probes the sound card and determines which drive is suitable.
#
kldload snd_driver
#
##########
##########
##
## (#indicates a typed command.)
##
## You must check to see which sound card is detected with this command:
## # cat /dev/sndstat
##
## You must add the detected sound driver manually to the /boot/loader.conf file.
## # nano /boot/loader.conf
##
## This line needs to be added to the /boot/loader.conf file:
##
## snd_xxx_load="YES"
##
## xxx is the sound card driver that is detected by the cat /dev/sndstat command.
##
## The sound card driver must be added using lower case letters.
##
##########
##########
#
# Reference:
# Setting Up the Sound Card
# www.freebsd.org/doc/en/books/handbook/sound-setup.html
#
##################################################################
##################################################################
#
echo "End of script."
#
@gburd
Copy link
Author

gburd commented Dec 8, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment