![]() ![]() | ![]() |
added new varz in rc.elwix - feature to auto-generate md5/sha1 checksumz for elwix.org
1: #!/bin/sh 2: # 3: # ELWIX install script for image 4: # 5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org> 6: # by Michael Pounov <misho@elwix.org> 7: # 8: # $Id: install2img.sh,v 1.1.2.3 2011/09/25 21:31:46 misho Exp $ 9: # 10: 11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix 12: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then 13: echo 14: echo "ELWIX project is not configured !?!" 15: echo 16: exit 1 17: fi 18: 19: if [ "${USER}" != "root" ]; then 20: echo 21: echo "ELWIX project is not configured - install must build under root !?!" 22: echo 23: exit 1 24: fi 25: 26: MNT="/mnt" 27: DEV="" 28: 29: mkdevice() 30: { 31: echo "+++ Make prepare file image ... " 32: rm -f $IMG 33: dd if=/dev/zero of=${IMG} bs=1024 count=${IMG_SIZE} 34: 35: echo -n "+++ Assign memory device to image ... " 36: DEV=`mdconfig -a -tvnode -f ${IMG}` 37: echo $DEV 38: 39: if [ -z "$DEV" ]; then 40: rm -f $IMG 41: exit 3 42: fi 43: } 44: 45: initdev() 46: { 47: echo -n "+++ Init device label ... " 48: if disklabel -w $1; then 49: echo "OK" 50: else 51: echo "Failed!" 52: exit 3 53: fi 54: 55: if newfs -b8192 -f1024 -m0 -Lelwix ${1}a; then 56: echo "+++ Formatting ... OK" 57: else 58: echo "+++ Formatting ... Failed!" 59: exit 3 60: fi 61: } 62: 63: mountdev() 64: { 65: echo -n "+++ Mount device $1 to $MNT ... " 66: if mount /dev/${1}a $MNT; then 67: echo "OK" 68: else 69: echo "Failed!" 70: exit 4 71: fi 72: } 73: 74: umountdev() 75: { 76: echo -n "+++ Unmount $MNT ... " 77: if umount $MNT; then 78: echo "OK" 79: else 80: echo "Failed!" 81: exit 4 82: fi 83: } 84: 85: enablejfs() 86: { 87: if tunefs -n enable -j enable ${1}a; then 88: echo "Start FS Journaling ... OK" 89: else 90: echo "Start FS Journaling ... Failed!" 91: exit 6 92: fi 93: } 94: 95: boot2dev() 96: { 97: echo -n "+++ Installboot to device $1 ... " 98: if disklabel -B -b ${WORLD}/boot/boot -m ${TARGET} ${1}; then 99: echo "OK" 100: else 101: echo "Failed!" 102: exit 7 103: fi 104: } 105: 106: install2() 107: { 108: echo -n "+++ Install ELWIX OS from $1 into $MNT ... " 109: if tar -xzvpf $1 -C $MNT; then 110: echo "OK" 111: else 112: echo "Failed!" 113: exit 5 114: fi 115: } 116: 117: cleandev() 118: { 119: mdconfig -d -u $1 120: } 121: 122: gencksum() 123: { 124: echo -n "+++ Generate check sums ... " 125: md5 ${IMG} >${MD5CHK} 126: sha1 ${IMG} >${SHA1CHK} 127: echo "OK" 128: } 129: 130: ### main() 131: 132: if [ ! -r ${1:-"${REL}/${OS}"} ]; then 133: echo 134: echo "Error:: ELWIX OS file not found!" 135: echo 136: exit 2 137: fi 138: 139: mkdevice 140: 141: initdev $DEV 142: 143: mountdev $DEV 144: install2 ${1:-"$REL/$OS"} 145: umountdev 146: 147: #enablejfs $DEV 148: boot2dev $DEV 149: 150: cleandev $DEV 151: 152: gencksum 153: echo "ELWIX OS image complete."