diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2009-06-13 17:17:14 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2009-06-13 17:17:14 +0200 |
commit | b448bbcdab09b70b4d03ea0bc9167878e7f054da (patch) | |
tree | 40ea72e4979ce176f6280b25368713122bee1b9c /scripts | |
parent | d804be5baee6590ff6e91d267c8cb9933ed7ac60 (diff) | |
parent | d2e5a673aa7637c990ca7307e831327eb67e3fe7 (diff) |
Merge branch 'master' of ssh://openadk.org/git/openadk
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install.sh | 101 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/md5sum | 4 | ||||
-rw-r--r-- | scripts/scan-pkgs.sh | 7 |
3 files changed, 74 insertions, 38 deletions
diff --git a/scripts/install.sh b/scripts/install.sh index 9baf4f428..926c03b6b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ $(id -u) -ne 0 ];then printf "Installation is only possible as root\n" exit 1 @@ -55,16 +55,20 @@ else fi cfgfs=1 -while getopts "n" option +rb532=0 +while getopts "nr" option do case $option in n) - cfgfs=0 - ;; + cfgfs=0 + ;; + r) + rb532=1 + ;; *) - printf "Option not recognized\n" - exit 1 - ;; + printf "Option not recognized\n" + exit 1 + ;; esac done shift $(($OPTIND - 1)) @@ -84,6 +88,18 @@ else printf "$2 is not a file, Exiting\n" exit 1 fi + if [ $rb532 -eq 1 ];then + if [ -z $3 ];then + printf "Please give the kernel as third parameter\n" + exit 2 + fi + if [ -f $3 ];then + printf "Installing $3 on $1\n" + else + printf "$3 is not a file, Exiting\n" + exit 1 + fi + fi if [ -b $1 ];then printf "Using $1 as CF/USB disk for installation\n" printf "This will destroy all data on $1, are you sure?\n" @@ -127,7 +143,24 @@ if [ $($sfdisk -l $1 2>/dev/null|grep Empty|wc -l) -ne 4 ];then fi printf "Create partition and filesystem\n" -if [ $cfgfs -eq 0 ];then +if [ $rb532 -ne 0 ];then + rootpart=${1}2 + $parted -s $1 mklabel msdos + sleep 2 + maxsize=$(parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//') + rootsize=$(($maxsize-2)) + + $parted -s $1 unit cyl mkpart primary ext2 0 1 + $parted -s $1 unit cyl mkpartfs primary ext2 1 $rootsize + $parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize + $parted -s $1 set 1 boot on + $sfdisk --change-id $1 1 27 + $sfdisk --change-id $1 3 88 + dd if=$3 of=${1}1 + sync +else + rootpart=${1}1 + if [ $cfgfs -eq 0 ];then $sfdisk $1 << EOF ,,L ; @@ -135,51 +168,50 @@ $sfdisk $1 << EOF ; y EOF - -$mke2fs ${1}1 - -else -$parted -s $1 mklabel msdos -sleep 2 -declare -i maxsize -maxsize=$(parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//') -let rootsize=$maxsize-1 - -$parted -s $1 unit cyl mkpartfs primary ext2 0 $rootsize -$parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize -$parted -s $1 set 1 boot on -$sfdisk --change-id $1 2 88 + $mke2fs ${rootpart} + else + $parted -s $1 mklabel msdos + sleep 2 + maxsize=$(parted $1 -s unit cyl print |awk '/^Disk/ { print $3 }'|sed -e 's/cyl//') + rootsize=$(($maxsize-1)) + + $parted -s $1 unit cyl mkpartfs primary ext2 0 $rootsize + $parted -s $1 unit cyl mkpart primary fat32 $rootsize $maxsize + $parted -s $1 set 1 boot on + $sfdisk --change-id $1 2 88 + fi fi if [ $? -eq 0 ];then - printf "Successfully created partition ${1}1\n" + printf "Successfully created partition ${rootpart}\n" else printf "Partition creation failed, Exiting.\n" exit 1 fi -sleep 4 -$tune2fs -c 0 -i 0 ${1}1 >/dev/null - +sleep 2 +$tune2fs -c 0 -i 0 ${rootpart} >/dev/null if [ $? -eq 0 ];then - printf "Successfully disabled filesystem checks on ${1}1\n" + printf "Successfully disabled filesystem checks on ${rootpart}\n" else printf "Disabling filesystem checks failed, Exiting.\n" + exit 1 fi tmp=$(mktemp -d) -mount -t ext2 ${1}1 $tmp +mount -t ext2 ${rootpart} $tmp printf "Extracting install archive\n" tar -C $tmp -xzpf $2 printf "Fixing permissions\n" chmod 1777 $tmp/tmp chmod 4755 $tmp/bin/busybox -printf "Copying grub files\n" -mkdir $tmp/boot/grub -cp /boot/grub/stage1 $tmp/boot/grub -cp /boot/grub/stage2 $tmp/boot/grub -cp /boot/grub/e2fs_stage1_5 $tmp/boot/grub +if [ $rb532 -ne 0 ];then + printf "Copying grub files\n" + mkdir $tmp/boot/grub + cp /boot/grub/stage1 $tmp/boot/grub + cp /boot/grub/stage2 $tmp/boot/grub + cp /boot/grub/e2fs_stage1_5 $tmp/boot/grub cat << EOF > $tmp/boot/grub/menu.lst serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 @@ -192,13 +224,14 @@ root (hd0,0) kernel /boot/kernel root=/dev/sda1 init=/init console=ttyS0,115200 console=tty0 panic=10 rw EOF -printf "Installing Grub bootloader\n" + printf "Installing Grub bootloader\n" $grub --batch --no-curses --no-floppy --device-map=/dev/null >/dev/null << EOF device (hd0) $1 root (hd0,0) setup (hd0) quit EOF +fi printf "Creating device nodes\n" mknod -m 666 $tmp/dev/null c 1 3 diff --git a/scripts/md5sum b/scripts/md5sum index 6a95a4707..24e1e9fac 100644..100755 --- a/scripts/md5sum +++ b/scripts/md5sum @@ -2,8 +2,8 @@ # This file is part of the OpenADK project. OpenADK is copyrighted # material, please see the LICENCE file in the top-level directory. -if [ -x /usr/bin/md5sum ];then - md5sum "$@" +if [ -x /usr/bin/md5sum ]; then + /usr/bin/md5sum "$@" else md5 "$@" | sed 's#MD5 (\([^)]*\)) = \(.*\)#\2 \1#' fi diff --git a/scripts/scan-pkgs.sh b/scripts/scan-pkgs.sh index 524680b05..69f2b1e3a 100644 --- a/scripts/scan-pkgs.sh +++ b/scripts/scan-pkgs.sh @@ -1,5 +1,6 @@ # This file is part of the OpenADK project. OpenADK is copyrighted # material, please see the LICENCE file in the top-level directory. +# # Scan host-tool prerequisites of certain packages before building. if test -z "$BASH_VERSION"; then @@ -61,8 +62,10 @@ fi if [[ -n $NEED_SSLDEV ]]; then if ! test -f /usr/lib/pkgconfig/openssl.pc >/dev/null; then - echo >&2 You need openssl headers to build $NEED_SQUID - out=1 + if ! test -f /usr/include/openssl/ssl.h >/dev/null; then + echo >&2 You need openssl headers to build $NEED_SQUID + out=1 + fi fi fi |