Commit Diff


commit - fc89ca98bade80726e1528d5569b027a1ad7a751
commit + 4e5b017f4ae372ad64a6dd7e588767d0ae41f638
blob - 75c2b9f306de2a46985bfc2815a5fcb738219c03
blob + 4ab82ee3670a75bd6258916d967525f5ff0a9288
--- infrastructure/bin/setupos
+++ infrastructure/bin/setupos
@@ -3,23 +3,19 @@
 # Setup OpenBSD
 
 VERSION="54"
+MIRROR="ftp://ftp.eu.openbsd.org/pub/OpenBSD/snapshots/`uname -m`"
 
-if [ -n $PKG_PATH ]; then
-        MIRROR=$(grep ^installpath /etc/pkg.conf | sed 's/packages\///g' | awk '{ print $3 }')
-else
-        MIRROR="ftp://ftp.eu.openbsd.org/pub/OpenBSD/snapshots/$(uname -m)"
-fi
-
 in_linux ()
 {
-	curl ftp://ftp.eu.openbsd.org/pub/OpenBSD/snapshots/amd64/cd$VERSION.iso > /boot/cd$VERSION.iso
+	curl $MIRROR/cd$VERSION.iso > /boot/cd$VERSION.iso
 	yum install syslinux
 	cp /usr/share/syslinux/memdisk /boot/
-		
+	mv /boot/grub/grub.conf{,_}
+
 	cat > /boot/grub/grub.cfg << "EOF"
 	set default=0
 	set timeout=5
-	title "OpenBSD  installation"
+	title "OpenBSD $VERSION installation"
 		kernel /memdisk iso
 		initrd /cd$VERSION.iso
 	EOF
@@ -27,14 +23,20 @@ in_linux ()
 
 in_openbsd ()
 {
+	if [ -n $PKG_PATH ]; then
+		MIRROR=$(grep ^installpath /etc/pkg.conf | sed 's/packages\///g' | awk '{ print $3 }')
+	fi
 	ftp $MIRROR/bsd.rd -o /bsd.rd
-	echo "boot bsd.rd" > /etc/boot.conf && reboot
+	[ -e /etc/boot.conf ] && mv /etc/boot.conf{,_}
+	echo "boot bsd.rd" > /etc/boot.conf
 }
 
 if [ `uname` -eq "Linux" ]; then
 	in_linux();
+	sync && reboot;
 elif [ `uname` -eq "OpenBSD" ]; then
 	in_openbsd();
+	sync && reboot;
 else
 	echo "No support"
 fi