#!/bin/csh
# 
#
#   getPackages-0.0.1a3 for Darwin-x86
#   (untested)
#
#   proclus (GPL)
#   Sun Jan 27 19:59:54 EST 2002
#   
#   In order to install the basic GNU-Darwin applications, run this file 
#   with the following command.
#
#	csh ./x86-getPackages 
#   
#   If you would like to configure your machine, then uncommment 
#   gnu-darwin-config below.  Be sure to read the directions at the end
#   of the script first.
#goto gnu-darwin-config

cd /var/db/pkg

echo 'fixing the database...'
foreach i ( Hermes-1.3.2 ImageMagick-5.3.8.2 ORBit-0.5.12 XFree86-3.3.6_10 aalib-1.2_2 autoconf-2.13.000227 bonobo-1.0.15 bzip2-1.0.1 cal-3.5 cal-3.5.x86 cclient-2001,1 curl-7.9.1 db3-3.2.9_2,1 dillo-0.6.2 dillo-0.6.2.x86 esound-0.2.23 everybuddy-0.2.1b6 fileutils-4.0 fileutils-4.0.x86 fnlib-0.5 fpx-1.2.0 freetype-1.3.1_1 freetype2-2.0.5 g-d-package-install.x86-2a.x86 gal-0.18 gconf-1.0.7 gdbm-1.8.0 gdk-pixbuf-0.13.0 gettext-0.10.35 gettext-0.10.38_1 gftp-gnome-2.0.8 ghostscript-gnu-6.52 glib-1.2.10_4 glibwww-0.2_1 gnomeaudio-1.4.0 gnomecanvas-0.13.0 gnomecontrolcenter-1.4.0.1 gnomecore-1.4.0.4_2 gnomedb-0.2.93 gnomelibs-1.4.1.2_1 gnomeprint-0.31 gnomevfs-1.0.3 gtk-1.2.10_2 gtkhtml-0.16.0 guile-1.4 imlib-1.9.11 ispell-3.2.05_1 ja-nkf-1.92_1 jbigkit-1.2 jpeg-6b lcms-1.07_1 libaudiofile-0.2.2 libgda-0.2.93 libghttp-1.0.9 libglade-0.17_1 libiconv-1.7_1 libimg-1.2.4 libproplist-0.10.1 libtool-1.3.4_2 libungif-4.1.0b1 libunicode-0.4_2 libwww-5.3.2 libxml-1.8.15 libxml2-2.4.10 links-0.96,1 lynx-ssl-2.8.4.1 m4-1.4_1 mpeg_lib-1.3.1 ncurses-5.2)
rm -rf $i
mkdir $i
touch $i/+COMMENT $i/+CONTENTS $i/+DESC $i/+REQUIRED_BY
echo -n .
end
echo .

foreach i ( png-1.2.4 libxml-1.8.17_1 perl-5.005_3 png-1.2.3 scrollkeeper-0.2,1 libiconv-1.7.0.1 libxml-1.8.17_1 perl-5.005_3 png-1.2.3 scrollkeeper-0.2,1 esound-0.2.28 expat-1.95.4 gettext-0.11.5 glib-1.2.10_7 gnomecontrolcenter-1.4.0.5_1 gnomecore-1.4.1_2 gnomelibs-1.4.2 gtk-1.2.10_7 imlib-1.9.14_1 perl-5.005_8 ORBit-0.5.16 bzip2-1.0.2 esound-0.2.26_2 expat-1.95.2 gdk-pixbuf-0.17.0 glib-1.2.10_5 gettext-0.11.1_3 gnomecanvas-0.17.0 gnomelibs-1.4.1.7 gnomemimedata-1.0.8 gnomevfs-1.0.5_4 libiconv-1.7_4 perl-5.005_1 gtk-1.2.10_4 jpeg-6b_1 libgnugetopt-1.1  tiff-3.5.7 tk-8.3.4_3 tcl-8.3.4_4 gettext-0.11.1_2 XFree86-3.3.6_11 oaf-0.6.7 openssl-0.9.6b patch-2.5.4 perl-5.005 pkgconfig-0.8.0 png-1.2.0 popt-1.5.1 postilion-0.9.3c pspell-0.12.2_1 scrollkeeper-0.2_3 t1lib-1.2 tcl-8.3.4_3 tcp_wrappers-7.6_1 tiff-3.5.5 tk-8.3.4_1 wget-1.7_4 windowmaker-0.70.0_1 wmicons-1.0 xpdf-0.92 xpm-3.4k)
rm -rf $i
mkdir $i
touch $i/+COMMENT $i/+CONTENTS $i/+DESC $i/+REQUIRED_BY
echo -n .
end

echo .


cd 
echo Database done
# install the base files
#
echo Installing basefiles... 
echo _____________________________________________________________________
echo It is still safe to exit with control-c.  It is also safe to
echo ignore missing package, mtree, and other messages.  We hope to have
echo them eliminated very soon.  
echo _____________________________________________________________________
echo updating package manager
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/g-d-package-install.x86-2a.1.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/g-d-package-install.x86-2a.5.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/g-d-package-install.x86-2a.5.tgz


echo 'installing 50 packages...'
echo '0         10        20        30        40        50        60        70' 
echo '|---------|---------|---------|---------|---------|---------|---------|---------' 

echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/Hermes-1.3.2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/ImageMagick-5.3.8.2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/ORBit-0.5.12.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/autoconf-2.13.000227.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/bzip2-1.0.1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/cclient-2001,1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/curl-7.9.1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/db3-3.2.9_2,1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/dlcompat-2001083.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/esound-0.2.23.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/everybuddy-0.2.1b6.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/fileutils-4.0.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/fnlib-0.5.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/freetype-1.3.1_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/gettext-0.10.35.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/gettext-0.10.38_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/gftp-gnome-2.0.8.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/glib-1.2.10_4.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/gnomelibs-1.4.1.2_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/gtk-1.2.10_2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/imlib-1.9.11.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/ja-nkf-1.92_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/jpeg-6b.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/libaudiofile-0.2.2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/libproplist-0.10.1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/libtool-1.3.4_2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/libungif-4.1.0b1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/links-0.96,1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/lynx-ssl-2.8.4.1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/m4-1.4_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/patch-2.5.4.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/pkgconfig-0.8.0.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/png-1.2.0.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/popt-1.5.1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/postilion-0.9.3c.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/t1lib-1.2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/tcl-8.3.4_3.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/tcp_wrappers-7.6_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/tiff-3.5.5.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/tk-8.3.4_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/wget-1.7_4.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/windowmaker-0.80.0_1.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/wmicons-1.0.x86.tgz
echo  .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/xpdf-0.92.x86.tgz
echo ______________________________________________________________________
echo The next few packages may give many error messages.
echo These messages are safely ignored.
echo ______________________________________________________________________
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/ispell-3.2.05_1.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/dillo-0.6.2.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/libimg-1.2.4.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/scrollkeeper-0.2_3.x86.tgz
echo -n .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/libxml-1.8.15.x86.tgz
echo .;/usr/sbin/pkg_add -f http://gnu-darwin.sourceforge.net/x86/packages/All/ncurses-5.2.x86.tgz
echo 'package installation finished'
echo ______________________________________________________________________
echo Congratulations... You have installed the GNU-Darwin base packages.
echo It is ok to disconnect from the internet now.   
echo ______________________________________________________________________
exit


gnu-darwin-config:
# Use the following commands to configure your machine as GNU-Darwin
#

# Darwin network and user setup

setenv IPnumber  ?.?.?.?
setenv Router    ?.?.?.?
setenv NameServer    ?.?.?.?
setenv your_hostname ????
setenv user_name ?????          # one word

# For Darwin, Set the variables above, and run this script.
# Install wget, then uncomment "goto essential_binaries" above

#goto various_edits

network:
ifconfig en0 $IPnumber up
route add default $Router
sshd
hostname $your_hostname
niutil -create . /locations/resolver
niutil -createprop . /locations/resolver nameserver $NameServer

make_user:
mkdir /Users/$user_name
niutil -create . /users/$user_name
niutil -createprop . /users/$user_name uid 1001
niutil -createprop . /users/$user_name gid 0
niutil -createprop . /users/$user_name shell /bin/tcsh
niutil -createprop . /users/$user_name home /Users/$user_name
echo enter password for $user_name
passwd $user_name
chown -R $user_name /Users/$user_name
chown -R .wheel /Users/$user_name

restart_netinfo:
# kill netinfod and lookupd with -HUP
kill -HUP `ps -ax | grep netinfod | grep -v grep | awk '{print $1}'`
kill -HUP `ps -ax | grep lookupd | grep -v grep | awk '{print $1}'`
exit

make_links:
echo Making links.  Fixing directories.
cd /usr/local/
cd share/
ln -s misc/terminfo .
cd /usr/local/
cp -rf share/* /usr/X11R6/share/
rm -rf share
ln -s /usr/X11R6/bin/XDarwin /usr/X11R6/bin/XFree86
ln -s /usr/X11R6/share .
ln -s /usr/X11R6/bin/enlightenment /bin
ln -s /usr/X11R6/lib/libfreetype.7.0.dylib /usr/X11R6/lib/libfreetype.6.dylib
ln -s /usr/local/bin/dillo /usr/X11R6/bin/mozilla
ln -s /usr/local/bin/dillo /usr/X11R6/bin/netscape
ln -s /usr/local/bin/dillo /usr/X11R6/bin/netscape.bin
ln -s /usr/bin/cc /usr/local/bin/gcc      
ln -s /usr/bin/c++ /usr/local/bin/g++
ln -s /usr/bin/cc /usr/bin/gcc
ln -s /usr/bin/c++ /usr/bin/g++
ln -s /usr/include/limits.h /usr/local/include/values.h
touch /usr/include/malloc.h
cd share/
echo Making GNOME files universal...
cp -rf gnome/* ./
echo removing duplicates...
rm -rf gnome
echo Linking...
ln -s /usr/X11R6/share gnome
echo Done

misc:
/usr/libexec/locate.updatedb &
rehash
killall mtree
echo Done!
echo If you know VI and Darwin networking, then set \"goto various_edits\"
echo Otherwise, see the Darwinfo FAQ http://darwinfo.org/ about how to make the
echo network settings permanent.
exit

# Some of these edits are required to make the network settings permanent.
# See Darwinfo FAQ for more info.  http://darwinfo.org/faq.shtml#resolv
# Everything below requires some manual entry 
# Just use this as a guide

various_edits:
cd ~
#scp $Router:/etc/hosts .
#cat hosts >> /etc/hosts
vi /etc/hostconfig
vi /etc/hosts
vi /etc/iftab
niload hosts / < /etc/hosts
echo The following hosts have been added to the NetInfo database.
nidump hosts /
kill -HUP `ps -ax | grep netinfod | grep -v grep | awk '{print $1}'`
kill -HUP `ps -ax | grep lookupd | grep -v grep | awk '{print $1}'`