Log:
Merge with trunk + fix bug nr. 5
Modified:
branches/rene/build.sh
branches/rene/etc_boot.conf.tpl
branches/rene/etc_rc.local.tpl
branches/rene/etc_rc.restore.tpl
branches/rene/etc_rc.tpl
branches/rene/home_live_.config_menus_applications.menu.tpl
branches/rene/usr_local_sbin_syncsys.tpl
Modified: branches/rene/build.sh
==============================================================================
--- branches/rene/build.sh (original)
+++ branches/rene/build.sh Tue Nov 4 11:04:16 2008
@@ -45,7 +45,7 @@
export CACHE_ROOT=$BASE/cache
export MASTER_SITES=http://mirror.startek.ch
-export PKG_PATH=http://mirror.switch.ch/ftp/pub/OpenBSD/$RELEASE/packages/$ARCH/:$MASTER_SITES/OpenBSD/pkg/$ARCH/
+export PKG_PATH=http://mirror.switch.ch/ftp/pub/OpenBSD/$RELEASE/packages/$ARCH/:$MASTER_SITES/OpenBSD/packages/$RELEASE/$ARCH/
export CWD=$(pwd)
export THIS_OS=$(uname)
@@ -125,29 +125,31 @@
done
echo "$OPTIONS (ok)"
- echo -n "Free space in $BASE: "
- AVAIL=$(df -k | grep $BASE_FS | awk '{print $4}')
- if [ "$AVAIL" -ge "$MIN_SPACE_REQ" ]
- then
- echo "$AVAIL kb (ok)"
- else
- echo "$AVAIL kb (NOT ok)"
- fi
-
echo -n "$BASE "
- touch "$BASE/test"
- if [ $? = '0' ]; then
+ touch "$BASE/test"
+ if [ $? = '0' ]; then
echo 'is writeable (ok)'
rm $BASE/test
else
echo "isn't writable (NOT ok)"
return 1
fi
+
+ echo -n "Free space in $BASE: "
+ test -d $IMAGE_ROOT && rm -rf $IMAGE_ROOT
+ test -f $BASE/bsdanywhere$R-$ARCH.iso && rm -f $BASE/bsdanywhere$R-$ARCH.iso
+ AVAIL=$(df -k | grep $BASE_FS | awk '{print $4}')
+ if [ "$AVAIL" -ge "$MIN_SPACE_REQ" ]
+ then
+ echo "$AVAIL kb (ok)"
+ else
+ echo "$AVAIL kb (NOT ok)"
+ return 1
+ fi
}
prepare_build() {
echo -n 'Preparing build environment ... '
- test -d $IMAGE_ROOT && rm -rf $IMAGE_ROOT
mkdir -p $IMAGE_ROOT
mkdir -p $CACHE_ROOT
echo done
@@ -163,9 +165,9 @@
done
}
-# Get generic boot loaders and ram disk kernel.
+# Get generic boot loaders.
install_boot_files() {
- for i in cdbr cdboot bsd.rd
+ for i in cdbr cdboot
do
test -r $CACHE_ROOT/$i || \
ftp -o $CACHE_ROOT/$i $MASTER_SITES/OpenBSD/stable/$RELEASE-stable/$ARCH/$i
@@ -238,7 +240,7 @@
# Download and install packages.
echo
- pkg_add -x iperf nmap tightvnc-viewer rsync pftop trafshow pwgen hexedit hping mozilla-firefox-2.0.0.14 mozilla-thunderbird gqview bzip2 epdfview ipcalc isearch BitchX imapfilter gimp abiword privoxy tor arping e-20071211p3 audacious mutt-1.5.17p0-sasl-sidebar-compressed screen-4.0.3p1 smartmontools rsnapshot darkstat aescrypt aiccu amap angst httptunnel hydra iodine minicom nano nbtscan nepim netfwd netpipe ngrep
+ pkg_add -x iperf nmap tightvnc-viewer rsync pftop trafshow pwgen hexedit hping mozilla-firefox-2.0.0.14 mozilla-thunderbird gqview bzip2 epdfview ipcalc isearch BitchX imapfilter gimp abiword privoxy tor arping e-20071211p3 audacious mutt-1.5.17p0-sasl-sidebar-compressed screen-4.0.3p1 smartmontools rsnapshot darkstat aescrypt aiccu amap angst httptunnel hydra iodine minicom nano nbtscan nepim netfwd netpipe ngrep galculator mboxgrep nemesis newsfetch queso radiusniff scanssh smtpscan ssldump stress stunnel
# Leave the chroot environment.
exit
Modified: branches/rene/etc_boot.conf.tpl
==============================================================================
--- branches/rene/etc_boot.conf.tpl (original)
+++ branches/rene/etc_boot.conf.tpl Tue Nov 4 11:04:16 2008
@@ -1 +1 @@
-boot /bsd.mp
+set image /bsd.mp
Modified: branches/rene/etc_rc.local.tpl
==============================================================================
--- branches/rene/etc_rc.local.tpl (original)
+++ branches/rene/etc_rc.local.tpl Tue Nov 4 11:04:16 2008
@@ -27,7 +27,7 @@
if [ $physmem -gt 512 ]
then
- echo -n "Do you want to preload free memory to speed up BSDanywhere? (N/y) "
+ echo -n "Preload free memory to speed up BSDanywhere? (N/y) "
read doit
if [ "$doit" == "y" ] || [ "$doit" == "Y" ] || [ "$doit" == "yes" ] || [ "$doit" == "Yes" ]
then
@@ -83,65 +83,65 @@
done
}
-# Ask for setting the keyboard layout and pre-set the X11 layout, too.
+# Ask for setting the keyboard layout.
sub_kblayout() {
- echo "Select keyboard layout *by number*:"
- select kbd in $(kbd -l | grep -v encoding | egrep '^[a-z]{2,2}.?[swapctrlcaps|declk|dvorak|iopener|nodead]*.?[dvorak|iopener]*$')
+ echo -n "keyboard mapping? ('L' for list) "
+ read kbd
+ while [ $kb = "L" ]
do
- # validate input
- echo $kbd | egrep -q '^[a-z]{2,2}.?[swapctrlcaps|declk|dvorak|iopener|nodead]*.?[dvorak|iopener]*$'
- if [ "$?" = '0' ]; then
-
- # set console mapping
- /sbin/kbd "$kbd"
-
- # write X11 mapping into site wide config
- if [ "$kbd" = 'sg' ]; then
- xkbd=ch
- elif [ "$kbd" = 'sv' ]; then
- xkbd=se
- else
- xkbd=$(echo "$kbd" | awk -F. {'print $1}')
- fi
-
- echo "/usr/X11R6/bin/setxkbmap $xkbd &" > /etc/X11/.xinitrc
- break
-
- fi
+ echo "Major tables: be br cf de dk es fr hu it jp la lt lv nl no pl pt ru sf sg si sv tr ua uk us"
+ echo -n "keyboard mapping? ('L' for list) "
+ read kbd
done
+
+ # validate input
+ echo $kbd | egrep -q '^[a-z]{2,2}.?[swapctrlcaps|declk|dvorak|iopener|nodead]*.?[dvorak|iopener]*$'
+ if [ "$?" = '0' ]; then
+
+ # set console mapping
+ /sbin/kbd "$kbd"
+ else
+ echo "Unknown keyboard mapping. Keyboard mapping untouched!"
+ fi
}
# Find all real network interfaces and offer to run dhclient/rtsol on
# each. Also offer to synchronize the time using a default ntpd.conf.
sub_networks() {
- echo -n "Do you want to auto configure the network? (Y/n) "
+ echo -n "Auto configure the network? (Y/n) "
read net
if [ -z "$net" ] || [ "$net" = "y" ] || [ "$net" = "Y" ] || [ "$net" = "yes" ] || [ "$net" = "Yes" ]
then
for nic in $(ifconfig | awk -F: '/^[a-z]+[0-9]: flags=/ { print $1 }' | egrep -v "lo|enc|pflog")
do
- echo -n "Do you want to configure $nic for dhcp? (Y/n) "
+ echo -n "Configure $nic for dhcp? (Y/n) "
read if
if [ -z "$if" ] || [ "$if" = "y" ] || [ "$if" = "Y" ] || [ "$if" = "yes" ] || [ "$if" = "Yes" ]
then
- sudo ifconfig "$nic" up
- sudo dhclient "$nic"
- sudo rtsol "$nic"
+ ifconfig "$nic" up
+ dhclient "$nic"
+ rtsol "$nic"
+ echo "dhcp NONE NONE NONE" > /etc/hostname.$nic
+ echo "rtsol" >> /etc/hostname.$nic
fi
done
- echo -n "Do you want to synchronize the time using ntpd? (Y/n) "
+ echo -n "Synchronize the time using ntpd? (Y/n) "
read ntp
if [ -z "$ntp" ] || [ "$ntp" = "y" ] || [ "$ntp" = "Y" ] || [ "$ntp" = "yes" ] || [ "$ntp" = "Yes" ]
then
- sudo ntpd -s &
+ ntpd -s &
+ echo "ntpd_flags=" >> /etc/rc.conf.local
fi
fi
}
# Always ask for the keyboard layout first, otherwise subsequent
# questions may have to be answered on an unset (=us) layout.
-sub_kblayout
-sub_timezone
-sub_networks
+if [ ! -f /tmp/restore ]
+then
+ sub_kblayout
+ sub_timezone
+ sub_networks
+fi
sub_mfsmount
Modified: branches/rene/etc_rc.restore.tpl
==============================================================================
--- branches/rene/etc_rc.restore.tpl (original)
+++ branches/rene/etc_rc.restore.tpl Tue Nov 4 11:04:16 2008
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2008 Rene Maroufi
+# Copyright (c) 2008 Rene Maroufi, Stephan A. Rickauer
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -16,58 +16,75 @@
#
# This script restores /etc, /var and /root during BSDanywhere's system boot.
+#
+### Functions go first
+#
+
sub_restore() {
if [ -r /mnt/sys.cio ]
then
cd /
- echo 'Restoring data ... '
+ echo -n 'Restoring data ... '
cpio -iu < /mnt/sys.cio
+ >/tmp/restore
echo done
else
echo "Can't find sys.cio!" >&2
- STATUS=2
+ exit 2
fi
}
-STATUS=0
+sub_umount() {
+ echo -n "Attempting to unmount ${device} ... "
+ umount /mnt \
+ && echo done || echo failed
+}
-usbdevs -d | grep umass >/dev/null
-if [ $? -eq 0 ]
-then
- echo "A USB device has been found. To restore previously saved system data"
- echo -n "specify a drive without /dev and partition (e.g. 'sd0') or 'no': "
+sub_bsdmount() {
+ echo -n "Attempting to mount BSD partition ${device} ... "
+ mount /dev/"${device}"a /mnt \
+ && echo done || echo failed
+}
- read usbs
- if [ "$usbs" = "n" ] || [ "$usbs" = "no" ] || [ "$usbs" = "No" ] || [ "$usbs" = "NO" ] || [ "$usbs" = "N" ]
- then
- exit 0
- fi
+sub_msdosmount() {
+ echo -n "Attempting to mount MSDOS partition ${device} ... "
+ mount_msdos /dev/"${device}"i /mnt \
+ && echo done || echo failed
+}
- SFLAG=0
+sub_find_umass() {
+ $(usbdevs -d | grep umass) || exit 1
+}
- disklabel "${usbs}" 2>/dev/null | grep MSDOS | grep i: >/dev/null
- if [ $? -eq 0 ]
- then
- mount_msdos /dev/"${usbs}"i /mnt
- SFLAG=1
- sub_restore
- umount /mnt
- fi
+#
+### Main
+#
- disklabel "${usbs}" 2>/dev/null | grep 4.2BSD | grep a: >/dev/null
- if [ $? -eq 0 ]
- then
- mount /dev/"${usbs}"a /mnt
- SFLAG=1
- sub_restore
- umount /mnt
- fi
+sub_find_umass
- if [ $SFLAG -eq 0 ]
- then
- echo "Can't find partition!" >&2
- STATUS=1
- fi
+echo "A USB device has been found. To restore previously saved system data"
+echo -n "specify a drive without /dev and partition (e.g. 'sd1') or 'no': "
+
+read device
+device=$(echo $device | tr '[:upper:]' '[:lower:]')
+
+if [ "$device" = "n" ] || [ "$device" = "no" ] || [ -z "$device" ]
+then
+ exit 0
+fi
+
+disklabel "${device}" 2>/dev/null | grep MSDOS | grep i: >/dev/null \
+ && fs=msdos
+
+disklabel "${device}" 2>/dev/null | grep 4.2BSD | grep a: >/dev/null \
+ && fs=bsd
+
+if [ "$fs" ]; then
+ sub_$fs\mount
+else
+ echo "Can't find usable partition on device!" >&2
+ exit 3
fi
-exit $STATUS
+sub_restore
+sub_umount
Modified: branches/rene/etc_rc.tpl
==============================================================================
--- branches/rene/etc_rc.tpl (original)
+++ branches/rene/etc_rc.tpl Tue Nov 4 11:04:16 2008
@@ -209,8 +209,8 @@
trap "echo 'Boot interrupted.'; exit 1" 3
umount -a >/dev/null 2>&1
-mount -a -t nonfs,vnd
-mount -uw / # root on nfs requires this, others aren't hurt
+mount -a -t nonfs,vnd >/dev/null 2>&1
+mount -uw / >/dev/null 2>&1 # root on nfs requires this, others aren't hurt
# XXX (root now writeable)
# BSDanywhere specific: Set timemark for syncsys.
@@ -451,9 +451,9 @@
# /var/crash should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.
-if [ -d /var/crash ]; then
- savecore ${savecore_flags} /var/crash
-fi
+#if [ -d /var/crash ]; then
+# savecore ${savecore_flags} /var/crash
+#fi
if [ X"${afs}" = X"YES" -a -c /dev/xfs0 ]; then
echo -n 'mounting afs:'
@@ -487,13 +487,13 @@
'password file may be incorrect -- /etc/ptmp exists'
fi
-echo clearing /tmp
+#echo clearing /tmp
# prune quickly with one rm, then use find to clean up /tmp/[lq]*
# (not needed with mfs /tmp, but doesn't hurt there...)
-(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
- find . ! -name . ! -name lost+found ! -name quota.user \
- ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
+#(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
+# find . ! -name . ! -name lost+found ! -name quota.user \
+# ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
# create Unix sockets directories for X if needed and make sure they have
# correct permissions
Modified: branches/rene/home_live_.config_menus_applications.menu.tpl
==============================================================================
--- branches/rene/home_live_.config_menus_applications.menu.tpl (original)
+++ branches/rene/home_live_.config_menus_applications.menu.tpl Tue Nov 4 11:04:16 2008
@@ -45,6 +45,7 @@
<Menu>
<Name>Accessories</Name>
<Include> <Category>Console</Category> </Include>
+ <Include> <Category>Utility</Category> </Include>
</Menu>
</Menu>
Modified: branches/rene/usr_local_sbin_syncsys.tpl
==============================================================================
--- branches/rene/usr_local_sbin_syncsys.tpl (original)
+++ branches/rene/usr_local_sbin_syncsys.tpl Tue Nov 4 11:04:16 2008
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2008 Rene Maroufi
+# Copyright (c) 2008 Rene Maroufi, Stephan A. Rickauer
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -14,43 +14,66 @@
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
-# This script creates a backup of modified files in /etc, /var and /root.
+# This script creates a cpio backup of modified files in /etc, /var and /root.
+
+#
+### Functions go first
+#
sub_backup() {
find /etc /var /root -newer /etc/timemark ! -type s ! -type p | cpio -o > /mnt/sys.cio
}
-mount | grep mnt
-if [ $? -eq 0 ]
-then
- echo "Something is already mounted on /mnt!" >&2
- echo "Please umount /mnt first and then try again!" >&2
- exit 1
-fi
+sub_check() {
+ if [ -n "$(mount | grep '/mnt ')" ]
+ then
+ echo "Something is already mounted on /mnt!" >&2
+ echo "Please umount /mnt first and then try again!" >&2
+ exit 1
+ fi
+}
-echo "This script overwrites previously written (old) backup data!"
-echo -n "Which device is your USB drive (without '/dev/', e.g. 'sd0')? "
-read usb
-
-flag=0
-disklabel "${usb}" 2>/dev/null | grep MSDOS | grep i: >/dev/null
-if [ $? -eq 0 ]
-then
- mount_msdos /dev/"${usb}"i /mnt
- sub_backup
- umount /mnt
- flag=1
-fi
-if [ "$flag" -eq 0 ]
-then
- disklabel "${usb}" 2>/dev/null | grep 4.2BSD | grep a: >/dev/null
- if [ $? -eq 0 ]
- then
- mount /dev/"${usb}"a /mnt
- sub_backup
- umount /mnt
- else
- echo "Can't find partition on device!" >&2
- exit 3
- fi
+sub_umount() {
+ echo -n "Attempting to unmount ${device} ... "
+ umount /mnt \
+ && echo done || echo failed
+}
+
+sub_bsdmount() {
+ echo -n "Attempting to mount BSD partition ${device} ... "
+ mount /dev/"${device}"a /mnt \
+ && echo done || echo failed
+}
+
+sub_msdosmount() {
+ echo -n "Attempting to mount MSDOS partition ${device} ... "
+ mount_msdos /dev/"${device}"i /mnt \
+ && echo done || echo failed
+}
+
+#
+### Main
+#
+
+sub_check
+
+echo "This program overwrites previously written backup data!"
+echo -n "Storage device to write the backup data on (e.g. sd1)? "
+
+read device
+
+disklabel "${device}" 2>/dev/null | grep MSDOS | grep i: >/dev/null \
+ && fs=msdos
+
+disklabel "${device}" 2>/dev/null | grep 4.2BSD | grep a: >/dev/null \
+ && fs=bsd
+
+if [ "$fs" ]; then
+ sub_$fs\mount
+else
+ echo "Can't find usable partition on device!" >&2
+ exit 3
fi
+
+sub_backup
+sub_umount