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 _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"