From owner-freebsd-questions@FreeBSD.ORG Tue May 31 03:19:42 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 841D61065672 for ; Tue, 31 May 2011 03:19:42 +0000 (UTC) (envelope-from xnooby@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id EA27D8FC16 for ; Tue, 31 May 2011 03:19:41 +0000 (UTC) Received: by bwz12 with SMTP id 12so4865485bwz.13 for ; Mon, 30 May 2011 20:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=5jfZZut95pRDROiVLN/VyUQ8hkm74XaF4cwwijXddcg=; b=W7OG9lqQjW9Zra5Xr6m6W6owXimcnYh/ayC14k98Aofv6nMfme7NxaUW0mAkoIKT/w xRPt2bE6zXPYCin+8Nd7+iwtais+VkUOxBaXeppkXeXK9wGkg82J0ae3zAT86G3t3tJv SbQ9f65ItmsZLJOrDLtUHQIu0kBza7Vgxt2KQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=cUBcoyq4s2zB5t0t0Yu1dFxSyd8BZGAEWAPA5QF5WtdnQIwbXVjKqrRxboXXcTT+f+ 5V7W7m8jzzF2MOyLHGnCrvlPtK/MidWwbmrbkW188Di9RKitrOIYege1O4y9PE9I1pLs gJFIy84+mxu4tviTcyjGf7ti2x1CHBwTBTRFU= MIME-Version: 1.0 Received: by 10.204.3.196 with SMTP id 4mr3105587bko.188.1306811980280; Mon, 30 May 2011 20:19:40 -0700 (PDT) Received: by 10.204.25.78 with HTTP; Mon, 30 May 2011 20:19:40 -0700 (PDT) Date: Mon, 30 May 2011 23:19:40 -0400 Message-ID: From: Xn Nooby To: FreeBSD Mailing List Content-Type: text/plain; charset=ISO-8859-1 Subject: A small script to customize FreeBSD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 03:19:42 -0000 Hello. I wrote a script to install FreeBSD 8.2 on to a real machine, or a 64-bit Virtualbox VM. It has a modular approach where you can pick which functions will be run on a different target system. It can be tweaked easily. I wrote it so that I could do a quick "plain vanilla install", and then run this script to set up my user, SVN server, gnome, firefox4, flash, nvidia driver, vbox additons, and other things. I thought I would post it in case other beginners need some thing like this to help them configure a machine. I started off with detailed notes, then thought I might as well script it. When you run it, the only user interaction is having to enter the user password twice. Let me know if anyone has any suggestions. #!/bin/sh loadMe() { echo loadMe... pw useradd -n theuser -s /bin/csh -m pw usermod theuser -G wheel,operator passwd theuser echo '#exec openbox-session' >> /home/theuser/.xinitrc chown theuser:theuser /home/theuser/.xinitrc chmod u+x /home/theuser/.xinitrc echo '#!/bin/sh' > /home/theuser/init_theuser.sh echo 'nspluginwrapper -v -a -i' >> /home/theuser/init_theuser.sh chown theuser:theuser /home/theuser/init_theuser.sh chmod u+x /home/theuser/init_theuser.sh } loadPorts() { echo loadPorts... freebsd-update fetch install portsnap fetch extract } loadX11() { echo loadX11... pkg_add -r xorg echo 'dbus_enable="YES"' >> /etc/rc.conf echo 'hald_enable="YES"' >> /etc/rc.conf /usr/local/etc/rc.d/hald start /usr/local/etc/rc.d/dbus start Xorg -configure sed ' /Section "Device"/ a\ Option "DRI" "Off" ' xorg.conf.new > xorg.conf.sed cp xorg.conf.sed /etc/X11/xorg.conf } loadSoundHP() { echo loadsoundHP... kldload snd_driver cat /dev/sndstat echo 'snd_atiixp_load="YES"' >> /boot/loader.conf echo 'snd_uaudio_load="YES"' >> /boot/loader.conf } loadSoundVMW() { echo loadsoundVMW... kldload snd_driver cat /dev/sndstat echo 'snd_es137x_load="YES"' >> /boot/loader.conf } loadSoundXPS() { echo loadsoundXPS... kldload snd_driver cat /dev/sndstat echo 'snd_hda_load="YES"' >> /boot/loader.conf } loadSoundVBX() { echo loadsoundVBX... kldload snd_driver cat /dev/sndstat echo 'snd_ich_load="YES"' >> /boot/loader.conf } loadFF() { echo loadFF... pkg_add -r firefox echo 'sem_load="YES"' >> /boot/loader.conf } loadApps() { echo loadApps... apps="bash unzip p7zip vlc xmms subversion mplayer openbox icewm cmdwatch xfe miro filezilla" for x in $apps do pkg_add -r $x done } loadVboxAdds() { echo loadVboxAdds... #cd /usr/ports/emulators/virtualbox-ose-additions #make install clean pkg_add -r virtualbox-ose-additions echo 'vboxguest_enable="YES"' >> /etc/rc.conf sed ' /Section "Screen"/ a\ DefaultDepth 24 ' /etc/X11/xorg.conf > /etc/X11/xorg.conf.sed cp /etc/X11/xorg.conf.sed /etc/X11/xorg.conf sed ' /Depth 24/ a\ Modes "1024x768" ' /etc/X11/xorg.conf > /etc/X11/xorg.conf.sed cp /etc/X11/xorg.conf.sed /etc/X11/xorg.conf sed -e 's/"vesa"/"vboxvideo"/' /etc/X11/xorg.conf > /etc/X11/xorg.conf.sed cp /etc/X11/xorg.conf.sed /etc/X11/xorg.conf echo '#!/bin/sh' >> /etc/rc.local echo '/usr/local/sbin/VBoxService' >> /etc/rc.local chmod a+x /etc/rc.local } loadFonts() { echo loadFonts... cd /usr/ports/x11-fonts/webfonts make install clean pkg_add -r dejavu cd sed ' /Section "Module"/ a\ Load "freetype"\ Load "type1" ' /etc/X11/xorg.conf > /etc/X11/xorg.conf.sed cp /etc/X11/xorg.conf.sed /etc/X11/xorg.conf sed ' /Section "Files"/ a\ FontPath "/usr/local/lib/X11/fonts/webfonts/"\ FontPath "/usr/local/lib/X11/fonts/dejavu/" ' /etc/X11/xorg.conf > /etc/X11/xorg.conf.sed cp /etc/X11/xorg.conf.sed /etc/X11/xorg.conf fc-cache -f -v } loadFlash() { echo loadFlash... kldload linux #cd /usr/ports/emulators/linux_base-f10 #make install clean pkg_add -r linux_base-f10 echo 'linux_enable="YES"' >> /etc/rc.conf echo 'linproc /usr/compat/linux/proc linprocfs rw 0 0' >> /etc/fstab mount -a #cd /usr/ports/www/nspluginwrapper #make install clean pkg_add -r nspluginwrapper cd /usr/ports/www/linux-f10-flashplugin10 make makesum make install clean cd mkdir /usr/local/lib/browser_plugins ln -s /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so /usr/local/lib/browser_plugins/ rehash } loadVB() { echo loadVB... pkg_add -r virtualbox-ose echo 'vboxnet_enable="YES"' >> /etc/rc.conf echo 'vboxdrv_load="YES"' >> /boot/loader.conf pw groupmod vboxusers -m theuser } loadSvn() { echo loadSvn... pkg_add -r subversion mkdir /home/svn-repo pw user add -n svn -u 3690 -d /home/svn-repo chsh -s /bin/false svn echo 'svnserve_enable="YES"' >> /etc/rc.conf echo 'svnserve_data="/home/svn-repo"' >> /etc/rc.conf echo 'svnserve_user="svn"' >> /etc/rc.conf echo 'svnserve_group="svn"' >> /etc/rc.conf rehash svnadmin create /home/svn-repo cd /home/svn-repo/conf echo 'theuser = theuserpw' >> passwd sed ' /# anon-acces/ a\ anon-access = none\ auth-access = write\ password-db = passwd ' svnserve.conf > svnserve.conf.sed cp svnserve.conf.sed svnserve.conf cd chown -R svn:svn /home/svn-repo/ chmod -R 770 /home/svn-repo/* /usr/local/etc/rc.d/svnserve start } testy() { echo testy... } loadGnome() { echo loadGnome... pkg_add -r gnome2 pkg_add -r gnome2-fifth-toe pkg_add -r gnome2-hacker-tools pkg_add -r gnome2-office pkg_add -r gnome2-power-tools echo 'proc /proc procfs rw 0 0' >> /etc/fstab echo '#gnome_enable="YES"' >> /etc/rc.conf echo '#exec gnome-session' >> /home/theuser/.xinitrc } loadnVidia() { echo loadnVidia... cd /usr/ports/x11/nvidia-driver make install clean echo 'nvidia_load="YES"' >> /boot/loader.conf sed -e 's/"nv"/"nvidia"/' /etc/X11/xorg.conf > /etc/X11/xorg.conf.sed cp /etc/X11/xorg.conf.sed /etc/X11/xorg.conf cd /usr/ports/x11/nvidia-xconfig make install clean cd /usr/ports/x11/nvidia-settings make install clean } # ======================= itype=xps # enable export to track 8.2-STABLE export PACKAGESITE="ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/" # ======================= if [ $itype = vbox64 ]; then loadPorts loadX11 loadFF loadApps loadFonts loadFlash loadMe loadSvn loadVboxAdds loadSoundVBX #loadGnome fi # ======================= if [ $itype = xps ]; then loadPorts loadX11 loadFF loadApps loadFonts loadFlash loadMe loadSvn loadSoundXPS loadGnome loadVB loadnVidia fi