aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2006-07-16 14:53:22 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 11:51:23 +0200
commit1df9e6131e7cc4a501a627b763dd18ce1f8a38ab (patch)
tree38638a90198864c61564783154f456bf71f68c98
parent[RELEASE] flxutils-0.1.11.2 (diff)
downloadflxutils-1df9e6131e7cc4a501a627b763dd18ce1f8a38ab.tar.gz
[RELEASE] flxutils-0.1.11.3v0.1.11.3
-rwxr-xr-xscripts/flxextract12
-rwxr-xr-xscripts/mkinstall8
-rwxr-xr-xscripts/mkinstall21223
3 files changed, 1241 insertions, 2 deletions
diff --git a/scripts/flxextract b/scripts/flxextract
index dae9650..e4aa4ee 100755
--- a/scripts/flxextract
+++ b/scripts/flxextract
@@ -1,4 +1,12 @@
#!/bin/bash
+#
+# flxextract - package extracter - version 0.0.2 - 2003-06-16
+# This file is part of the Formilux project : http://formilux.ant-computing.com/
+#
+# Copyright (C) 2001-2003 Benoit Dolez & Willy Tarreau
+# mailto: benoit@ant-computing.com,willy@ant-computing.com
+#
+# This program is licenced under GPLv2 ( http://www.gnu.org/licenses/gpl.txt )
function main {
local file packages pack pkgsrc
@@ -103,13 +111,13 @@ fi
# par défaut, ROOTDIR est fonction de la date
DATE=$(date +%Y%m%d-%H%M%S)
-ROOTDIR=${ROOTDIR:-/tmp/package-$DATE}
+ROOTDIR=${ROOTDIR:-/tmp/package-$DATE-$$}
#if [ -e $ROOTDIR ] ; then
# echo "Error : directory $ROOTDIR already exists."
# exit 1
#fi
-LOGFILE=${LOGFILE:-/tmp/package-$DATE.log}
+LOGFILE=${LOGFILE:-/tmp/package-$DATE-$$.log}
if [ -e $LOGFILE ] ; then
echo "Error : log file $LOGFILE exists."
exit 0
diff --git a/scripts/mkinstall b/scripts/mkinstall
index f1e2d1d..3ccd20e 100755
--- a/scripts/mkinstall
+++ b/scripts/mkinstall
@@ -1,4 +1,12 @@
#!/bin/sh
+#
+# /sbin/mkinstall - Formilux System Installer - version 1.0.0 - 2003-03-20
+# This file is part of the Formilux project : http://formilux.ant-computing.com/
+#
+# Copyright (C) 2001-2003 Benoit Dolez & Willy Tarreau
+# mailto: benoit@ant-computing.com,willy@ant-computing.com
+#
+# This program is licenced under GPLv2 ( http://www.gnu.org/licenses/gpl.txt )
# This function collects some information in /proc and other places.
# It should be called ASAP.
diff --git a/scripts/mkinstall2 b/scripts/mkinstall2
new file mode 100755
index 0000000..ee98736
--- /dev/null
+++ b/scripts/mkinstall2
@@ -0,0 +1,1223 @@
+#!/bin/bash
+#
+# /sbin/mkinstall - System Installer - version 1.9.0 - 2003-06-16
+# This file is part of the Formilux project : http://formilux.ant-computing.com/
+#
+# Copyright (C) 2001-2003 Benoit Dolez & Willy Tarreau
+# mailto: benoit@ant-computing.com,willy@ant-computing.com
+#
+# This program is licenced under GPLv2 ( http://www.gnu.org/licenses/gpl.txt )
+
+cdlist=( )
+names=( )
+sizes=( )
+parts=( )
+
+# this utility uses a few temporary files :
+#
+# /tmp/fsmnt : <device><space><mount_point>
+# device=/dev/hda, /dev/sda1...
+# space=exactly one space
+# mount_mount=/home, /var, /, ..., mbr, cdrom, swap, <empty string when not affected>
+# /tmp/fsid : <device><space><hex_id><space><os_name>
+# /tmp/fstype : <device><space><fstype>
+# /tmp/fslist : <device>
+# /tmp/fssize : <device><space><size_in_kB>
+# /tmp/sourcepkg : symlink to the source packages directory
+
+# give it a number suffixed with a k,M,G,T, and it will return it reduced to
+# the nearest power of 1024 suffixed with k,M,G or T
+humansize() {
+ local pow val
+ local -a suff=( "" k M G T P )
+ case "${1##[0-9]*}" in
+ k) pow=1;;
+ M) pow=2;;
+ G) pow=3;;
+ T) pow=4;;
+ P) pow=5;;
+ *) pow=0;;
+ esac
+ val=${1%%[a-zA-Z]*}
+ # we don't return values lower than 10 when possible
+ while [ $val -ge 10240 ]; do
+ ((pow++))
+ ((val/=1024))
+ done
+ REPLY=$val${suff[$pow]}
+ echo -n $REPLY
+}
+
+detect_cdrom() {
+ cdlist=($(grep -i '^drive name:' /proc/sys/dev/cdrom/info |cut -f2 -d:))
+ CDROMS="${cdlist[*]}"
+}
+
+detect_disks() {
+ local i j major minor size name rest
+
+ names=( )
+ sizes=( )
+ parts=( )
+
+ rm -f /tmp/partitions
+ tail +3 /proc/partitions | sort -k4.1 >/tmp/partitions
+ while read major minor size name rest; do
+ if ((i >= 0)); then
+ names[i]=$name
+ sizes[i]=$size
+ parts[i]=1
+ fi
+ ((i++))
+ done < /tmp/partitions
+
+ i=0
+ while ((i < ${#names[@]})); do
+ if [ -n "${names[i]}" ]; then
+ j=0
+ while ((j < ${#names[@]})); do
+ if [ $i -ne $j -a -n "${names[j]}" -a -z "${names[j]##${names[i]}*}" ]; then
+ names[j]=""
+ ((parts[i]+=${parts[j]}))
+ fi
+ ((j++))
+ done
+ fi
+ ((i++))
+ done
+
+ i=0 j=0
+ while ((i < ${#names[@]})); do
+ if [ -n "${names[i]}" -a "${cdlist[*]##${names[i]}}" = "${cdlist[*]}" ]; then
+ names[j]=${names[i]}
+ sizes[j]=${sizes[i]}
+ ((parts[j]=${parts[i]}-1))
+ ((j++))
+ fi
+
+ if ((i >= j)); then
+ unset names[i] parts[i] sizes[i]
+ names=("${names[@]}") parts=("${parts[@]}") sizes=("${sizes[@]}")
+ else
+ ((i++))
+ fi
+ done
+ # now we have the list of the hard disks :
+ # names[] contains their name in /dev
+ # sizes[] contains their size in blocks (1 kB)
+ # parts[] contains their number of partitions
+}
+
+# This function collects some information in /proc and other places.
+# It should be called ASAP.
+
+function init {
+ #umount /mnt/cdrom >/dev/null 2>&1 # to avoid stupid recursive copying !
+ detect_cdrom
+ detect_disks
+ mkdir -p $ROOTDIR >/dev/null 2>&1
+}
+
+# displays the main menu
+# if an arg is passed, it will be used as the name entry of the default action.
+# it returns the name of the entry in REPLY
+# returns 0 if OK, 1 if Cancel/Exit.
+function menu_main {
+ REPLY=$(dialog --title " Formilux Installation Utility " --no-cancel --no-shadow ${1:+--default-item $1 }\
+ --menu "Installation Menu\n\n Press <Up>/<Down> to select an item.\n Press <Tab> to move between [OK] and [Cancel].\n Press <Enter> to confirm your choice." 24 80 14 \
+ "PART" "Configure Partitions and File Systems" \
+ "SOURCE" "Select Packages Source" \
+ "PKG" "Select which Packages to Install" \
+ "CONFIG" "Build Configuration" \
+ "SAVE" "Save Current Configuration" \
+ "LILO" "Run LILO" \
+ "UNMOUNT" "Unmount all File Systems" \
+ "SHELL" "Get Access to a Shell" \
+ "EXIT" "Exit this Utility" 2>&1 | grep -v EXIT)
+ [ -n "$REPLY" ]
+}
+
+
+# presents a list of hard disks and lets the user choose one.
+# the default one can be passed in $1
+# returns 0 if OK, 1 if Cancel/Exit.
+function menu_harddisk {
+ local -a args=( )
+ local i=0
+ local model
+ while ((i < ${#names[@]})); do
+ model='unknown model'
+ [ -e "/proc/ide/${names[i]}/model" ] && model=$(</proc/ide/${names[i]}/model)
+ args=("${args[@]}" "${names[i]}" "$model, $(humansize ${sizes[i]}k)B, ${parts[i]} part.")
+ ((i++))
+ done
+
+ REPLY=$(dialog --title " Formilux Installation Utility " --no-shadow ${1:+--default-item $1 } --menu "\nSelect a Hard Disk to Configure\n\n Press <Up>/<Down> to select an item.\n Press <Tab> to move between [OK] and [Cancel].\n Press <Enter> to confirm your choice." 24 80 12 "${args[@]}" "EXIT" "Exit this menu" 2>&1 |grep -v EXIT)
+ [ -n "$REPLY" ]
+}
+
+# presents a list of hard disks partitions and lets the user choose one.
+# the disk is passed in $1
+# the default one can be passed in $2
+# returns 0 if OK, 1 if Cancel/Exit.
+function menu_partition {
+ local -a args=( )
+ local dev=$1
+ local disk=${1##/dev/}
+ local def=$2
+ local mnt
+ local device size id syst rest
+
+ for device in $(grep "^$dev" /tmp/fslist 2>/dev/null); do
+ size=$(grep "^$device " /tmp/fssize 2>/dev/null |cut -f2 -d' ')
+ mnt=$(grep "^$device " /tmp/fsmnt 2>/dev/null |cut -f2 -d' ')
+ id=$(grep "^$device " /tmp/fsid 2>/dev/null |cut -f2 -d' ')
+ syst=$(grep "^$device " /tmp/fsid 2>/dev/null |cut -f3 -d' ')
+ type=$(grep "^$device " /tmp/fstype 2>/dev/null |cut -f2 -d' ')
+ if [ -z "$mnt" ]; then
+ def=${def:-${device##/dev/}}
+ mnt="not assigned"
+ else
+ mnt="assigned to $mnt"
+ fi
+ if [ -z "$type" ]; then
+ def=${def:-${device##/dev/}}
+ type="not formated"
+ else
+ type="type $type"
+ fi
+ args=("${args[@]}" "${device##/dev/}" "$(humansize ${size}k)B, Id 0x$id($syst), $type, $mnt")
+ done
+
+ def=${def:-EXIT}
+ args=("${args[@]}" "CLEAR" "Clear ALL partitions on this disk" "FDISK" "Run fdisk on this disk")
+
+ REPLY=$(dialog --title " Formilux Installation Utility " --no-shadow ${def:+--default-item $def} --menu "\nSelect a Partition\n\n Press <Up>/<Down> to select an item.\n Press <Tab> to move between [OK] and [Cancel].\n Press <Enter> to confirm your choice." 24 80 12 "${args[@]}" "EXIT" "Exit this menu" 2>&1 |grep -v EXIT)
+ [ -n "$REPLY" ]
+}
+
+# reads the partition table on a disk and updates the associated files :
+# /tmp/fslist, /tmp/fssize, /tmp/fsid, /tmp/fsmnt, /tmp/fstype
+# the disk device is passed in $1 (/dev/xxx). There's no return code.
+function disk_read_part {
+ local dev=$1
+ local disk=${1##/dev/}
+ local device begin end cyl size id syst rest file
+
+ rm -f /tmp/sfdisk.$disk
+ for file in fslist fssize fsid; do
+ grep -v "^$dev" /tmp/$file 2>/dev/null >/tmp/${file}-; mv /tmp/${file}- /tmp/$file
+ done
+
+ for file in fsmnt fstype; do
+ grep "^$dev" /tmp/$file 2>/dev/null >/tmp/$file.$disk
+ grep -v "^$dev" /tmp/$file 2>/dev/null >/tmp/${file}-; mv /tmp/${file}- /tmp/$file
+ done
+
+ sfdisk -l $dev | tr '*' ' ' | grep '^/dev/' >/tmp/sfdisk.$disk
+ while read device begin end cyl size id syst rest; do
+ # let's ignore empty and extended partitions
+ [ "$id" = "0" -o "$id" = "5" ] && continue
+ size=${size%+}
+ echo "$device" >> /tmp/fslist
+ echo "$device $size" >> /tmp/fssize
+ echo "$device $id $syst" >> /tmp/fsid
+ if [ "$id" != "82" ] || grep -q "^$device " /tmp/fsmnt.$disk && ! grep -q "^$device swap" /tmp/fsmnt.$disk; then
+ grep "^$device " /tmp/fsmnt.$disk >> /tmp/fsmnt
+ grep "^$device " /tmp/fstype.$disk >> /tmp/fstype
+ else
+ echo "$device swap" >> /tmp/fsmnt
+ # we want to keep a trace of the format status of the swap partition
+ # instead of assuming it has already been formated
+ grep "^$device " /tmp/fstype.$disk >> /tmp/fstype
+ #echo "$device swap" >> /tmp/fstype
+ fi
+ done < /tmp/sfdisk.$disk
+ rm -f /tmp/sfdisk.$disk
+}
+
+# presents a list of possible actions for a partition :
+# - change its mount point
+# - format it
+# the partition is passed in $1
+# if a default choice should be proposed, its name must be in $2
+# returns 0 if OK, 1 if Cancel/Exit.
+function menu_setupfs {
+ local -a args=( )
+ local dev=$1
+ local def size type strext2s strext2l strext3 strreiser
+ local mnt
+
+ def=$2
+ mnt=$(grep "^$dev " /tmp/fsmnt 2>/dev/null |cut -f2 -d' ')
+ [ -z "$mnt" ] && { mnt="not assigned" ; def=${def:-"MNT"}; }
+
+ type=$(grep "^$dev " /tmp/fstype 2>/dev/null |cut -f2 -d' ')
+ [ -z "$type" ] && type="not formated"
+
+ size=$[ ($(grep "^$dev " /tmp/fssize 2>/dev/null | cut -f2 -d' ')+0) / 1024 ]
+
+ args=("MNT" "Change the mount point ($mnt)")
+
+ if [ "$mnt" = "swap" ]; then
+ args=("${args[@]}" "SWAP" "* mkswap $dev (format as swap)")
+ args=("${args[@]}" "SWAPC" " mkswap -c $dev (format and check