Changeset 181


Ignore:
Timestamp:
Dec 13, 2005, 1:35:27 AM (13 years ago)
Author:
bcornec
Message:

merge -r177:180 $SVN_M/branches/2.05

Location:
trunk
Files:
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/mindi/install.sh

    r158 r181  
    1 #!/bin/sh
     1#!/bin/bash
    22
    33if [ ! -f "mindi" ] ; then
     
    55    exit 1
    66fi
    7 local=/usr
    8 # local=/usr/local
     7
     8if [ "_$PREFIX" = "_" ]; then
     9    local=$PREFIX/usr
     10    if [ -f /usr/local/sbin/mindi ]; then
     11        echo "WARNING: /usr/local/sbin/mindi exists. You should probably remove it !"
     12    fi
     13    conf=$PREFIX/etc/mindi
     14else
     15    local=/usr/local
     16    if [ -f /usr/sbin/mindi ]; then
     17        echo "WARNING: /usr/sbin/mindi exists. You should probably remove the mindi package !"
     18    fi
     19    conf=$local/etc/mindi
     20fi
     21
    922if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
    1023    local=/ramdisk/usr
     
    1225fi
    1326
    14 mkdir -p $local/share/mindi
     27echo "mindi will be installed under $local"
     28
     29echo "Creating target directories ..."
     30mkdir -p $local/lib/mindi
     31mkdir -p $local/share/doc/mindi
    1532mkdir -p $local/share/man/man8
    1633mkdir -p $local/sbin
     34mkdir -p $conf
    1735
    18 #for i in aux-tools dev rootfs ; do
    19 #    [ -e "$i.tgz" ] && continue
    20 #    cd $i
    21 #    tar -c * | gzip -9 > ../$i.tgz
    22 #    cd ..
    23 #    rm -Rf $i
    24 #done
     36echo "Copying files ..."
     37cp deplist.txt $conf
     38cp -af rootfs aux-tools isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg parted2fdisk.pl syslinux.cfg syslinux-H.cfg dev.tgz Mindi $local/lib/mindi
     39chmod 755 $local/lib/mindi/rootfs/bin/*
     40chmod 755 $local/lib/mindi/rootfs/sbin/*
     41chmod 755 $local/lib/mindi/aux-tools/sbin/*
    2542
    26 cp --parents -pRdf * $local/share/mindi/
    27 ln -sf $local/share/mindi/mindi $local/sbin/
    28 chmod +x $local/sbin/mindi
     43cp -af analyze-my-lvm parted2fdisk.pl $local/sbin
     44if [ "$RPMBUILDMINDI" = "true" ]; then
     45    sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=/usr~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=/etc/mindi~" mindi > $local/sbin/mindi
     46else
     47    sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$local~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$conf~" mindi > $local/sbin/mindi
     48fi
     49chmod 755 $local/sbin/mindi
     50chmod 755 $local/sbin/analyze-my-lvm
     51chmod 755 $local/sbin/parted2fdisk.pl
     52
    2953cp -a mindi.8 $local/share/man/man8
     54cp -a CHANGES COPYING README README.busybox README.ia64 README.pxe TODO INSTALL $local/share/doc/mindi
     55
    3056echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
    31 ( cd $local/share/mindi/rootfs && tar -xzf symlinks.tgz )
     57
     58echo "Extracting symlinks ..."
     59( cd $local/lib/mindi/rootfs && tar -xzf symlinks.tgz )
     60
    3261ARCH=`/bin/arch`
    3362echo $ARCH | grep -x "i[0-9]86" &> /dev/null && ARCH=i386
    3463export ARCH
    35 ( cd $local/share/mindi/rootfs && mv bin/busybox-$ARCH bin/busybox)
     64
     65if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH ]; then
     66        echo "Installing busybox ..."
     67        mv $local/lib/mindi/rootfs/bin/busybox-$ARCH $local/lib/mindi/rootfs/bin/busybox
     68else
     69        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
     70fi
     71
    3672if [ "$ARCH" = "i386" ] ; then
    37     ( cd $local/share/mindi/rootfs && mv bin/busybox-$ARCH.net bin/busybox.net)
     73    if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH.net ]; then
     74        echo "Installing busybox.net ..."
     75        mv $local/lib/mindi/rootfs/bin/busybox-$ARCH.net $local/lib/mindi/rootfs/bin/busybox.net
     76    else
     77        echo "WARNING: no busybox.net found, mindi will not work on this arch ($ARCH) with network"
     78    fi
    3879fi
     80
    3981if [ "$ARCH" = "ia64" ] ; then
    40     make -f Makefile.parted2fdisk
    41     make -f Makefile.parted2fdisk install
    42     ( cd $local/share/mindi/rootfs && mv sbin/parted2fdisk-ia64 sbin/parted2fdisk)
     82    make -f Makefile.parted2fdisk DEST=$local/lib/mindi install
     83    if [ -f $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
     84        echo "Installing parted2fdisk ..."
     85        mv $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/lib/mindi/rootfs/sbin/parted2fdisk
     86    else
     87        echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
     88    fi
    4389else
    44     ( cd $local/share/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
     90    echo "Symlinking fdisk to parted2fdisk"
     91    ( cd $local/lib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
    4592fi
    46 ls /etc/mindi/* > /dev/null 2>/dev/null
    47 [ "$?" -ne "0" ] && rm -Rf /etc/mindi
     93
    4894exit 0
  • trunk/mindi/mindi

    r149 r181  
    11#!/bin/bash
    22
     3# $Id$
     4#
    35#-----------------------------------------------------------------------------
    46# mindi - mini-Linux distro based on the user's filesystem & distribution
     
    2527
    2628MINDI_VERSION=1.04_berlios
     29MINDI_PREFIX=XXX
     30MINDI_CONF=YYY
     31MINDI_SBIN=${MINDI_PREFIX}/sbin
     32MINDI_LIB=${MINDI_PREFIX}/lib/mindi
    2733
    2834EXTRA_SPACE=24576         ; # increase if you run out of ramdisk space
     
    4349    # you want to use your own kernel, or the supplied default.
    4450    # If "yes" mindi will automatically use your own kernel.
    45 MINDI_CONFIG="/etc/mindi/mindi.conf"
     51MINDI_CONFIG="$MINDI_CONF/mindi.conf"
    4652if [ -f $MINDI_CONFIG ]; then
    4753    . $MINDI_CONFIG
     
    104110        incoming=`ReadLine`
    105111    done
    106     if [ -e "$MINDI_HOME/memtest.img" ] ; then
     112    if [ -e "$MINDI_LIB/memtest.img" ] ; then
    107113#        echo -en "label memtest\n  kernel memtest.bin\n\n"
    108114        echo -en "label memtest\n  kernel memdisk\n  append initrd=memtest.img\n\n"
     
    126132    which afio > /dev/null 2> /dev/null || LogIt "afio not found... mindi doesn't need afio but Mondo does... Be aware...\n"
    127133    [ ! -e "/etc/issue.net" ] && > /etc/issue.net
    128     FDISK=$MINDI_HOME/parted2fdisk.pl
     134    FDISK=$MINDI_SBIN/parted2fdisk.pl
    129135    FDISKLOG=/tmp/parted2fdisk.log
    130136    touch $FDISKLOG
     
    214220    mappath=$1
    215221    KBDEPTH=$(($KBDEPTH+1))
    216     [ "$KBDEPTH" -gt "128" ] && Die "Edit $MINDI_HOME/mindi and disable FindAndAddUserKeyboardMappingFile (line 1170, approx.)"
     222    [ "$KBDEPTH" -gt "128" ] && Die "Edit $MINDI_SBIN/mindi and disable FindAndAddUserKeyboardMappingFile (line 1170, approx.)"
    217223    if [ -e "$bigdir/$mappath" ] ; then
    218224    echo "$mappath already added" >> $LOGFILE
     
    622628
    623629           if [ $SYMLINK -ne 1 ] ; then
    624               if [ -d "$mh/mindi" ] && [ -e "$mh/mindi/aux-tools" ] ; then
    625               [ "$MINDI_HOME" ] && Die "You have multiple instances of Mindi - one at $MINDI_HOME and one at $mh/mindi"
    626                       MINDI_HOME=$mh/mindi
    627               fi
    628630          if [ -d "$mh/mondo" ] && [ -e "$mh/mondo/restore-scripts" ] ; then
    629631              [ "$MONDO_HOME" ] && Die "You have multiple instances of Mondo - one at $MONDO_HOME and one at $mh/mondo"
     
    635637# end patch
    636638
    637 #   for mh in /usr/share /usr/local /usr/local/share /usr/share/local /opt /opt/share /usr ; do
    638 #       if [ -d "$mh/mindi" ] && [ -e "$mh/mindi/aux-tools" ] ; then
    639 #       [ "$MINDI_HOME" ] && Die "You have multiple instances of Mindi - one at $MINDI_HOME and one at $mh/mindi"
    640 #       MINDI_HOME=$mh/mindi
    641 #       fi
    642 #       if [ -d "$mh/mondo" ] && [ -e "$mh/mondo/restore-scripts" ] ; then
    643 #       [ "$MONDO_HOME" ] && Die "You have multiple instances of Mondo - one at $MONDO_HOME and one at $mh/mondo"
    644 #       MONDO_HOME=$mh/mondo
    645 #       fi
    646 #   done
    647 
    648     [ "$MINDI_HOME" = "" ] && Die "Unable to locate Mindi's home directory"
    649     echo "MINDI_HOME = $MINDI_HOME" >> $LOGFILE
     639    [ "$MINDI_PREFIX" = "XXX" ] && Die "Mindi has not been installed correctly."
     640    echo "MINDI_LIB = $MINDI_LIB" >> $LOGFILE
     641    echo "MINDI_SBIN = $MINDI_SBIN" >> $LOGFILE
     642    [ "$MINDI_CONF" = "YYY" ] && Die "Mindi has not been installed correctly."
     643    echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    650644    echo "MONDO_HOME = $MONDO_HOME" >> $LOGFILE
    651     [ -e "/etc/mindi" ] && MINDI_CONF=/etc/mindi || MINDI_CONF=$MINDI_HOME
    652     echo "MINDI_CONF = $MINDI_CONF" >> $LOGFILE
    653645    mkdir -p $CACHE_LOC
    654646}
     
    13411333    if [ -d "/proc/lvm" ] || [ -d "/dev/mapper" ]; then
    13421334    echo -en "\rAnalyzing LVM...\r"
    1343     all_partitions=`$MINDI_HOME/analyze-my-lvm | fgrep ">>>" | cut -d' ' -f2-32`
     1335    all_partitions=`$MINDI_SBIN/analyze-my-lvm | fgrep ">>>" | cut -d' ' -f2-32`
    13441336    fi
    13451337    all_partitions="$all_partitions `ListAllPartitions 2> /dev/null`"
     
    15051497    echo -en "  " > $1
    15061498    if [ "`cat /etc/issue.net 2> /dev/null | fgrep -i "debian"`" ] ; then
    1507         cat $MINDI_HOME/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ >> $1.tmp
    1508     else
    1509         cat $MINDI_HOME/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' '\\r' 'on' 'an' '\/' '`uname -r`' 'on' 'an' '`uname -m`/ >> $1.tmp
     1499        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ >> $1.tmp
     1500    else
     1501        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' '\\r' 'on' 'an' '\/' '`uname -r`' 'on' 'an' '`uname -m`/ >> $1.tmp
    15101502    fi
    15111503    cat $1.tmp | sed s/%r/"`uname -r`"/ | sed s/%t/"`hostname`"/ > $1
     
    15161508        elif [ ! "$MONDO_TMP" ] ; then
    15171509            echo -en "FYI, this is _not_ a Mondo Rescue CD.\n" >> $1
    1518             if [ -e "$MINDI_HOME/memtest.img" ] ; then
     1510            if [ -e "$MINDI_LIB/memtest.img" ] ; then
    15191511                echo -en "Type 'memtest' <Enter> to test your PC's memory intensively.\nJust press <Enter> to go to the main test menu.\n" >> $1
    15201512            fi
     
    16091601    cd $TMP_ROOT/iso
    16101602    mkdir -p $MONDO_ROOT/iso/isolinux
    1611     echo "mindi_home = $MINDI_HOME" >> $LOGFILE
    1612     cp $MINDI_HOME/mem{test,disk}* $MONDO_ROOT 2>> $LOGFILE
     1603    echo "mindi_lib = $MINDI_LIB" >> $LOGFILE
     1604    cp $MINDI_LIB/mem{test,disk}* $MONDO_ROOT 2>> $LOGFILE
    16131605    for i in memdisk memtest.bin memtest.img ; do
    1614     j=$MINDI_HOME/$i
     1606    j=$MINDI_LIB/$i
    16151607    k=$TMP_ROOT/iso/isolinux
    16161608    if [ -e "$j" ] ; then
     
    16741666    disksize=$1
    16751667    if [ "`cat /etc/issue.net 2> /dev/null | fgrep -i "debian"`" ] ; then
    1676         cat $MINDI_HOME/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/
    1677     else
    1678         cat $MINDI_HOME/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' 'r' 'on' 'an' 'm/' '`uname -r`' 'on' 'an' '`uname -m`/
     1668        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/
     1669    else
     1670        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' 'r' 'on' 'an' 'm/' '`uname -r`' 'on' 'an' '`uname -m`/
    16791671    fi
    16801672    if [ "$disksize" -gt "2880" ] ; then
     
    17331725    rdev -r vmlinuz 49152
    17341726
    1735     tar -zxf $MINDI_HOME/dev.tgz || LogIt "Cannot untar dev.tgz\n"
     1727    tar -zxf $MINDI_LIB/dev.tgz || LogIt "Cannot untar dev.tgz\n"
    17361728    losetup /dev/loop0 > /dev/null 2> /dev/null
    17371729    [ "$?" -eq "0" ] || losetup /dev/loop0 -d || Die "Please free up /dev/loop0 by typing 'losetup /dev/loop0 -d'.\nReboot if necessary.\n"
     
    18601852
    18611853
    1862 #MINDI_HOME=/usr/share/mindi
    1863 #rm -f /tmp/boot.img*
    1864 #write_full_floppy_of_kernel /usr/share/mindi/vmlinuz /tmp/boot.img 1440
    1865 #exit $?
    1866 
    1867 
    1868 
    1869 
    1870 
    18711854PrepareBootDiskImage_LILO() {
    18721855    local disksize imagesdir dev imagefile mountpoint fname i kernelpath ramdisksize cfg_file testpath options retval outstr old_pwd ooo max_kernel_size liloconf
     
    18791862    [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"
    18801863    echo -en "Making "$disksize"KB boot disk..."
    1881     TurnTgzIntoRdz $MINDI_HOME/rootfs $TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
     1864    TurnTgzIntoRdz $MINDI_LIB/rootfs $TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
    18821865    if [ "$ARCH" != "ia64" ] ; then
    18831866        [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size"
     
    19081891    cd $mountpoint
    19091892    if [ "$ARCH" != "ia64" ] ; then
    1910         tar -zxf $MINDI_HOME/dev.tgz || LogIt "Cannot untar dev.tgz\n"
     1893        tar -zxf $MINDI_LIB/dev.tgz || LogIt "Cannot untar dev.tgz\n"
    19111894    fi
    19121895    cd $old_pwd
     
    19311914    mkdir -p $mountpoint/tmp
    19321915    cp -f $TMP_ROOT/mondo-restore.cfg $mountpoint/tmp &> /dev/null
    1933     if [ -e "$MINDI_HOME/memtest.img" ] ; then
     1916    if [ -e "$MINDI_LIB/memtest.img" ] ; then
    19341917        echo -en "image=/memtest.bin\nlabel=memtest\nn" >> $liloconf
    19351918        echo -en "image=/memdisk\nlabel=memtest\nappend=\"initrd=memtest.img\"\n" >> $liloconf
     
    19721955# make it bootable
    19731956    rm -f $mountpoint/zero
    1974     [ -e "$MINDI_HOME/memdisk" ] && cp -f $MINDI_HOME/memdisk $mountpoint
     1957    [ -e "$MINDI_LIB/memdisk" ] && cp -f $MINDI_LIB/memdisk $mountpoint
    19751958    if [ "$disksize" -gt "2880" ] && [ ! "$KERN_DISK_MADE" ] ; then
    19761959        if [ "$ARCH" != "ia64" ] ; then
     
    20312014    [ ! -e "$kernelpath" ] && Die "PBDI - cannot find $kernelpath kernel"
    20322015    echo -en "Making "$disksize"KB boot disk..."
    2033     TurnTgzIntoRdz $MINDI_HOME/rootfs $TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
     2016    TurnTgzIntoRdz $MINDI_LIB/rootfs $TMP_ROOT/mindi.rdz $ramdisksize $disksize `du -sk $kernelpath | cut -f1` || Die "Could not turn rootfs into mindi.rdz; are you SURE your kernel supports loopfs?"
    20342017    [ "$disksize" != "1722" ] && [ "$disksize" != "2880" ] && [ "$disksize" != "5760" ] && Die "PDBI - disksize is $disksize - bad size"
    20352018    echo -en "..."
     
    20442027# play nicely and I don't care. :) I have worked around the problem. -Hugo, 06/27/2002
    20452028    if [ "$disksize" = "1722" ] ; then
    2046         gzip -dc $MINDI_HOME/sys-disk.raw.gz > $imagefile || Die "Cannot dd blank file"
     2029        gzip -dc $MINDI_LIB/sys-disk.raw.gz > $imagefile || Die "Cannot dd blank file"
    20472030    else
    20482031        dd if=/dev/zero of=$imagefile bs=1k count=$disksize &> /dev/null || Die "Cannot dd blank file"
     
    20562039    cd $mountpoint
    20572040    [ -e "$sys_cfg_file" ] || Die "Obi Wan, word up?"
    2058 #    tar -zxf $MINDI_HOME/dev.tgz || LogIt "Cannot untar dev.tgz\n" <--- present for LILO; is it nec. for SYSLINUX too?
     2041#    tar -zxf $MINDI_LIB/dev.tgz || LogIt "Cannot untar dev.tgz\n" <--- present for LILO; is it nec. for SYSLINUX too?
    20592042    cat $sys_cfg_file | HackSyslinuxFile $ramdisk_size $mountpoint > syslinux.cfg || Die "Cannot copy syslinux.cfg from mindi_home to tmp_root"
    20602043    if [ -e "$MONDO_TMP/start-nfs" ] ; then
     
    21102093    rm -f $mountpoint/zero
    21112094    mkdir -p $mountpoint/etc
    2112     [ -e "$MINDI_HOME/memdisk" ] && cp -f $MINDI_HOME/memdisk $mountpoint
     2095    [ -e "$MINDI_LIB/memdisk" ] && cp -f $MINDI_LIB/memdisk $mountpoint
    21132096    umount $mountpoint || Die "Cannot unmount mountpoint ($mountpoint)"
    21142097    echo -en "..."
     
    22162199
    22172200# more stuff
    2218 #    cp -f $MINDI_HOME/embleer* $bigdir
     2201#    cp -f $MINDI_LIB/embleer* $bigdir
    22192202    old_pwd=`pwd`
    22202203    cd $bigdir
    22212204
    2222     [ -e "$MINDI_HOME/aux-tools" ] || Die "aux-tools not found in Mindi's home dir. Do you have multiple copies of Mindi lying around? Please delete them. No, don't e-mail me and ask how. ;) Use 'rm'."
    2223     cp -Rdf $MINDI_HOME/aux-tools/* . 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping aux-tools\n"
    2224     if [ -e "$MINDI_HOME/x11-tools.tgz" ] ; then
    2225     tar -zxf $MINDI_HOME/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
     2205    [ -e "$MINDI_LIB/aux-tools" ] || Die "aux-tools not found in Mindi's home dir. Do you have multiple copies of Mindi lying around? Please delete them. No, don't e-mail me and ask how. ;) Use 'rm'."
     2206    cp -Rdf $MINDI_LIB/aux-tools/* . 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping aux-tools\n"
     2207    if [ -e "$MINDI_LIB/x11-tools.tgz" ] ; then
     2208    tar -zxf $MINDI_LIB/x11-tools.tgz 2>> $LOGFILE || LogIt "Warning - error occurred while unzipping x11-tools.tgz\n"
    22262209    fi
    22272210    if [ -e "$MONDO_HOME/restore-scripts" ] ; then
    22282211        cp -Rdf $MONDO_HOME/restore-scripts/* . 2>> $LOGFILE
    2229         [ "$?" -ne "0" ] && [ "`DidMondoCallMe`" ] && Die "Cannot find/install $MINDI_HOME/restore-scripts"
     2212        [ "$?" -ne "0" ] && [ "`DidMondoCallMe`" ] && Die "Cannot find/install $MINDI_LIB/restore-scripts"
    22302213    fi
    22312214    [ -d "/lib/dev-state" ] && cp --parents -pRdf /lib/dev-state .
     
    22462229    cp -f $TMP_ROOT/mountlist.txt $CACHE_LOC
    22472230    [ "`DidMondoCallMe`" ] && cp -f $minidir_root/$noof_disks/tmp/mountlist.txt $MONDO_TMP/.
    2248     [ -d "/proc/lvm" ] && $MINDI_HOME/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm
    2249     [ -d "/dev/mapper" ] && $MINDI_HOME/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm
     2231    [ -d "/proc/lvm" ] && $MINDI_SBIN/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm
     2232    [ -d "/dev/mapper" ] && $MINDI_SBIN/analyze-my-lvm > $minidir_root/$noof_disks/tmp/i-want-my-lvm
    22502233    cat $minidir_root/$noof_disks/tmp/mountlist.txt >> $LOGFILE
    22512234    ZipMinidirsIntoTarballs $minidir_root $tardir $noof_disks
     
    27282711    old_pwd=`pwd`
    27292712    cd $mountpoint
    2730 #    [ -e "$MINDI_HOME/memtest.img" ] && echo "Yep, this is a multi-function CD" > MULTIFUNC
     2713#    [ -e "$MINDI_LIB/memtest.img" ] && echo "Yep, this is a multi-function CD" > MULTIFUNC
    27312714    cp -Rdf $tgz_dir_fname/* . 2>> $LOGFILE >> $LOGFILE
    27322715    tar -zxf symlinks.tgz || Die "Cannot untar symlinks.tgz"
     
    28202803#   done
    28212804#    fi
    2822     if [ ! -e "/sbin/devfsd" ] || [ "$disksize" -lt "2880" ] || [ "$kernelpath" = "$MINDI_HOME/vmlinuz" ] ; then
     2805    if [ ! -e "/sbin/devfsd" ] || [ "$disksize" -lt "2880" ] || [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] ; then
    28232806        echo "Deleting devfsd daemon from ramdisk" >> $LOGFILE
    28242807        [ ! -e "/sbin/devfsd" ] && echo "...because /sbin/devfsd not found" >> $LOGFILE
    28252808        [ "$disksize" -lt "2880" ] && echo "...because disksize = $disksize" >> $LOGFILE
    2826         [ "$kernelpath" = "$MINDI_HOME/vmlinuz" ] && echo "...because kernel is failsafe" >> $LOGFILE
     2809        [ "$kernelpath" = "$MINDI_LIB/vmlinuz" ] && echo "...because kernel is failsafe" >> $LOGFILE
    28272810#        ls -l $mountpoint/sbin/devfsd &> /dev/null || Die "Can't find devfsd daemon on ramdisk"
    28282811        rm -f $mountpoint/sbin/devfsd
     
    29822965fi
    29832966FixPathIfBroken
    2984 [ -f "$MINDI_HOME/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_HOME/vmlinuz 2> /dev/null | grep "2\.4" | cut -d' ' -f1`
     2967[ -f "$MINDI_LIB/vmlinuz" ] && FAILSAFE_KVER=`strings $MINDI_LIB/vmlinuz 2> /dev/null | grep "2\.4" | cut -d' ' -f1`
    29852968AbortIfMkfsVfatMissing
    29862969### BCO
     
    31083091[ "$CDRECOVERY" = "yes" ] || CDRECOVERY=no
    31093092if [ "$CDRECOVERY" = "yes" ] ; then
    3110     iso_cfg_file=$MINDI_HOME/isolinux-H.cfg
    3111     sys_cfg_file=$MINDI_HOME/syslinux-H.cfg
     3093    iso_cfg_file=$MINDI_LIB/isolinux-H.cfg
     3094    sys_cfg_file=$MINDI_LIB/syslinux-H.cfg
    31123095else
    3113     iso_cfg_file=$MINDI_HOME/isolinux.cfg
    3114     sys_cfg_file=$MINDI_HOME/syslinux.cfg
     3096    iso_cfg_file=$MINDI_LIB/isolinux.cfg
     3097    sys_cfg_file=$MINDI_LIB/syslinux.cfg
    31153098fi
    31163099
     
    31343117mkdir -p $imagesdir
    31353118if [ ! "`DidMondoCallMe`" ] ; then
    3136     LogIt "Mindi Linux mini-distro generator v$MINDI_VERSION by Hugo Rabson"
    3137     LogIt "Latest Mindi is available from http://www.mondorescue.org"
     3119    LogIt "Mindi Linux mini-distro generator v$MINDI_VERSION"
     3120    LogIt "Latest Mindi is available from http://mondorescue.berlios.de"
    31383121    LogIt "BusyBox sources are available from http://www.busybox.net"
    31393122    LogIt "------------------------------------------------------------------------------"
     
    31973180fi
    31983181if [ "$YOUR_KERNEL_SUCKS" != "" ] || [ "$kernelpath" = "" ] || [ "$kernelpath" = "SUCKS" ] || [ "$kernelpath" = "FAILSAFE" ] ; then
    3199     kernelpath=$MINDI_HOME/vmlinuz
     3182    kernelpath=$MINDI_LIB/vmlinuz
    32003183    LogIt "I shall include Mindi's failsafe kernel, not your kernel, in the boot disks."
    32013184    LogIt "However, you are still running your kernel. If Mindi fails to create your"
     
    32033186    pwd=`pwd`
    32043187    cd $TMP_ROOT
    3205     bzip2 -dc $MINDI_HOME/lib.tar.bz2 | tar -x || Die "Cannot unzip lib.tar.bz2"
     3188    bzip2 -dc $MINDI_LIB/lib.tar.bz2 | tar -x || Die "Cannot unzip lib.tar.bz2"
    32063189    cd $pwd
    32073190    YOUR_KERNEL_SUCKS="Your kernel sucks"
     
    32473230
    32483231
    3249 [ -e "$MINDI_HOME/memtest.img" ] && BOOT_MEDIA_MESSAGE="$BOOT_MEDIA_MESSAGE\n\
     3232[ -e "$MINDI_LIB/memtest.img" ] && BOOT_MEDIA_MESSAGE="$BOOT_MEDIA_MESSAGE\n\
    32503233...Or type 'memtest' to test your PC's RAM thoroughly.\n"
    32513234
  • trunk/mindi/mindi.spec

    r158 r181  
    6363
    6464%{__rm} -rf $RPM_BUILD_ROOT
    65 MINDIDIR=$RPM_BUILD_ROOT%{_datadir}/mindi
    66 
    67 %{__mkdir_p} $MINDIDIR $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{_sysconfdir}/mindi $RPM_BUILD_ROOT%{_sbindir} $RPM_BUILD_ROOT/%{_mandir}/man8
    68 %{__cp} deplist.txt $RPM_BUILD_ROOT%{_sysconfdir}/mindi/
    69 %{__cp} -af * $MINDIDIR
    70 %{__cp} -af mindi.8 $RPM_BUILD_ROOT/%{_mandir}/man8
    71 
    72 %ifarch ia64
    73     %{__make} -f Makefile.parted2fdisk DEST=${MINDIDIR}/ install
    74     %{__mv} $MINDIDIR/rootfs/bin/busybox-ia64 $MINDIDIR/rootfs/bin/busybox
    75     %{__mv} $MINDIDIR/rootfs/sbin/parted2fdisk-ia64 $MINDIDIR/rootfs/sbin/parted2fdisk
    76 %else
    77     %{__mv} $MINDIDIR/rootfs/bin/busybox-i386 $MINDIDIR/rootfs/bin/busybox
    78     %{__mv} $MINDIDIR/rootfs/bin/busybox-i386.net $MINDIDIR/rootfs/bin/busybox.net
    79     %{__ln_s} fdisk $MINDIDIR/rootfs/sbin/parted2fdisk
    80 %endif
     65MINDIDIR=$RPM_BUILD_ROOT%{_libdir}/mindi
     66export PREFIX=${RPM_BUILD_ROOT}
     67export RPMBUILDMINDI="true"
     68
     69./install.sh
     70
    8171%{__rm} -f $MINDIDIR/rootfs/bin/busybox-ia64 $MINDIDIR/rootfs/sbin/parted2fdisk-ia64 $MINDIDIR/rootfs/bin/busybox-i386 $MINDIDIR/rootfs/bin/busybox-i386.net
    82 
    83 #
    84 # These are installed twice if not removed here
    85 #
    86 ( cd $MINDIDIR
    87 %{__rm} -f CHANGES INSTALL COPYING README TODO README.ia64 README.pxe mindi.8
    88 )
    89 
    90 # Symlinks
    91 
    92 cd $RPM_BUILD_ROOT%{_sbindir}
    93 %{__ln_s} -f %{_datadir}/mindi/mindi .
    94 %{__ln_s} -f %{_datadir}/mindi/analyze-my-lvm .
    95 %ifarch ia64
    96 %{__ln_s} -f %{_datadir}/mindi/parted2fdisk.pl .
    97 %endif
    9872
    9973%clean
     
    10175
    10276%post
     77if [ -f /usr/local/sbin/mindi ]; then
     78    echo "WARNING: /usr/local/sbin/mindi exists. You should probably remove your manual mindi installation !"
     79fi
     80
    10381%ifarch ia64
    10482    %{__mkdir_p} /usr/local/bin
     
    10684        %{__cp} /sbin/fdisk /sbin/fdisk.mondosav
    10785        %{__mv} /sbin/fdisk /usr/local/bin/fdisk
    108         %{__ln_s} -f /usr/share/mindi/parted2fdisk.pl /sbin/fdisk
     86        %{__ln_s} -f /usr/sbin/parted2fdisk.pl /sbin/fdisk
    10987        echo "Warning: you fdisk binary is now under /usr/local/bin"
    11088    fi
     
    11492%defattr(644,root,root,755)
    11593%config(noreplace) %{_sysconfdir}/mindi/deplist.txt
    116 %doc CHANGES INSTALL COPYING README TODO README.ia64 README.pxe
    117 %attr(755,root,root) %{_sbindir}/mindi
    118 %attr(755,root,root) %{_sbindir}/analyze-my-lvm
    119 %{_datadir}/mindi
     94%doc CHANGES INSTALL COPYING README TODO README.ia64 README.pxe README.busybox
     95%{_sbindir}
     96%{_libdir}/mindi
    12097%{_mandir}
    121 %attr(755,root,root) %{_datadir}/mindi/analyze-my-lvm
    122 %attr(755,root,root) %{_datadir}/mindi/mindi
    123 %attr(755,root,root) %{_datadir}/mindi/parted2fdisk.pl
    124 %attr(755,root,root) %{_datadir}/mindi/aux-tools/sbin/*
    125 %attr(755,root,root) %{_datadir}/mindi/rootfs/bin/*
    126 %attr(755,root,root) %{_datadir}/mindi/rootfs/sbin/*
    12798
    12899%changelog
     100* Fri Nov 05 2005 Bruno Cornec <bcornec@users.berlios.de> 1.05
     101- ia64 is now working
     102- use install.sh script
     103- use libdir for binary data
     104
    129105* Tue Sep 06 2005 Bruno Cornec <bcornec@users.berlios.de> 1.04_berlios
    130106- Merge of patches mentionned on mondo ML + ia64 updates
  • trunk/mindi/rootfs/etc/bashrc

    r30 r181  
    1 PATH=/mondo:/usr/share/mondo:/usr/share/mindi:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:.
     1PATH=/mondo:/usr/lib/mondo:/usr/lib/mindi:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:.
    22HOSTNAME="mondo"
    33TERM=linux
  • trunk/mindi/rootfs/sbin/init

    r149 r181  
    622622#    HandleCDROMorFloppies
    623623#el
    624 if [ "`| grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
     624if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ] ; then
    625625    HandleTape
    626626else
  • trunk/mondo/configure.in

    r129 r181  
    1 dnl Autoconfigure file for Mondo Rescue v2.0x_berlios
     1dnl Autoconfigure file for Mondo Rescue v2.0x
    22dnl Mondo by Hugo Rabson
    33dnl This script by Joshua Oreman
  • trunk/mondo/mondo.spec

    r129 r181  
    119119
    120120%attr(755,root,root) %{_sbindir}/*
    121 %attr(755,root,root) %{_datadir}/%{name}/restore-scripts/%{name}
    122 %{_datadir}/%{name}
     121%attr(755,root,root) %{_libdir}/%{name}/restore-scripts/%{name}
     122%{_libdir}/%{name}
    123123%{_mandir}/*
    124124%{_libdir}/*
     
    127127* Tue Oct 06 2005 Bruno Cornec <bcornec@users.berlios.de> 2.05_berlios
    128128- Memory management revision
     129- use libdir instead of datadir
    129130
    130131* Tue Sep 06 2005 Bruno Cornec <bcornec@users.berlios.de> 2.04_berlios
  • trunk/mondo/mondo/Makefile.am

    r129 r181  
    11SUBDIRS        = common mondoarchive mondorestore docs restore-scripts
    22
    3 pkgdata_DATA   = do-not-compress-these
     3pkglib_DATA   = do-not-compress-these
    44
    55install-data-hook: post-nuke.sample
    6     cp -R post-nuke.sample $(pkgdatadir)/
     6    cp -R post-nuke.sample $(pkglibdir)/
  • trunk/mondo/mondo/mondorestore/mondo-restore.c

    r171 r181  
    33753375        toggle_node_selection(filelist, FALSE);
    33763376        toggle_all_root_dirs_on(filelist);
     3377        // BERLIOS: /usr/lib ???
    33773378        toggle_path_selection(filelist, "/usr/share", TRUE);
    33783379//      show_filelist(filelist);
  • trunk/mondo/mondo/mondorestore/mondo-rstr-newt.c

    r127 r181  
    11/***************************************************************************
    2 mondo-rstr-newt.c  -  description
    3 -----------------
    4 
    5 begin: Fri Apr 19 16:40:35 EDT 2002
    6 copyright : (C) 2002 Mondo  Hugo Rabson
    7 email     : Hugo Rabson <hugorabson@msn.com>
    8 edited by : by Stan Benoit 4/2002
    9 email     : troff@nakedsoul.org
    10 cvsid     : $Id$
    11 ***************************************************************************/
    12 
    13 /***************************************************************************
    14  *                                                                         *
    15  *   This program is free software; you can redistribute it and/or modify  *
    16  *   it under the terms of the GNU General Public License as published by  *
    17  *   the Free Software Foundation; either version 2 of the License, or     *
    18  *   (at your option) any later version.                                   *
    19  *                                                                         *
    20  ***************************************************************************/
    21 /* mondo-rstr-newt.c               Hugo Rabson
    22 
    23 
    24 07/12
    25 - wider mountlist entry editor window
    26 
    27 03/28/2004
    28 - removed g_mountlist_fname
    29 
    30 07/02/2003
    31 - fixed calls to popup_and_get_string()
    32 
    33 06/05
    34 - cleaned up get_isodir_info()
    35 
    36 05/02
    37 - added strip_path() to improve file list display for long paths (Conor)
    38 
    39 04/24
    40 - added lots of assert()'s and log_OS_error()'s
    41 
    42 04/08/2003
    43 - commented out call to sort_mountlist_by_device(), just in case it's
    44   futzing with LVM/RAID users
    45 
    46 08/21/2002
    47 - fix MOUNTLIST_FNAME and RAIDTAB_FNAME if Reload button finds them empty
    48 
    49 08/19
    50 - fixed what_number_cd_is_this() to take bkpinfo as parameter
    51 
    52 07/01 - 07/31
    53 - renamed from mondo-newt.c to mondo-rstr-newt.c
    54 - moved lots of subroutines to libmondo-newt.c
    55 - added hooks to libmondo
    56 - better handling of yes/no/YES/NO
    57 - better "% done" feedback (Philippe de Muyter)
    58 
    59 05/01 - 06/30
    60 - trim trailing \n from fgets() in a couple of functions
    61 - expanded "May I write mountlist?" message
    62 - replace scanf() with a properly restricted fgets() (Troff)
    63 
    64 02/01 - 02/28/2002
    65 - allow up to 50 chars in popup_and_get_string()'s input field
    66 - if g_current_progress > g_maximum_progress then g_current_progress=g_max...
    67   to stop the progress bar from shooting off the RHS of the screen :)
    68 - beefed up the RAID-related logging a bit
    69 - don't complain if partition format is a number (1-255)
    70 - if hard disk does not exist then warn user when editing mountlist
    71 - when running 'eject -t', log its output
    72 
    73 [...]
    74 
    75 08/09/2001
    76 - created
     2 * $Id$
    773*/
    784
     
    13157{
    13258    /** buffers ***********************************************************/
    133     char tmp[MAX_STR_LEN];
     59    char *tmp;
    13460
    13561    /** newt **************************************************************/
     
    15783    newtPushHelpLine
    15884        ("   Add one of the following unallocated RAID partitions to this RAID device.");
    159     sprintf(tmp, "%-26s %s", "Device", "Size");
     85    asprintf(&tmp, "%-26s %s", "Device", "Size");
    16086    headerMsg = newtLabel(1, 1, tmp);
     87    paranoid_free(tmp);
     88
    16189    partitionsListbox =
    16290        newtListbox(1, 2, 6, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    196124
    197125
    198 
    199 
    200126/**
    201127 * Add an entry to @p mountlist.
     
    232158
    233159    /** buffers **********************************************************/
    234     char drive_to_add[MAX_STR_LEN];
    235     char mountpoint_str[MAX_STR_LEN];
    236     char size_str[MAX_STR_LEN];
    237     char device_str[MAX_STR_LEN];
    238     char format_str[MAX_STR_LEN];
     160    char *drive_to_add;
     161    char *mountpoint_str;
     162    char *size_str = NULL;
     163    char *device_str;
     164    char *format_str;
    239165
    240166    /** pointers *********************************************************/
     
    249175    assert(keylist != NULL);
    250176
    251     strcpy(device_str, "/dev/");
    252     strcpy(mountpoint_str, "/");
     177    asprintf(&device_str, "/dev/");
     178    asprintf(&mountpoint_str, "/");
    253179#ifdef __FreeBSD__
    254     strcpy(format_str, "ufs");
     180    asprintf(&format_str, "ufs");
    255181#else
    256     strcpy(format_str, "ext2");
     182    asprintf(&format_str, "ext2");
    257183#endif
    258     size_str[0] = '\0';
    259     /* sprintf(size_str,""); */
    260184    newtOpenWindow(20, 5, 48, 10, "Add entry");
    261185    label0 = newtLabel(2, 1, "Device:    ");
     
    267191    mountpointComp =
    268192        newtEntry(14, 2, mountpoint_str, 30, (void *) &mountpoint_here, 0);
     193
    269194    formatComp =
    270195        newtEntry(14, 4, format_str, 15, (void *) &format_here, 0);
     
    280205    for (b_res = NULL; b_res != bOK && b_res != bCancel;) {
    281206        b_res = newtRunForm(myForm);
    282         strcpy(device_str, device_here);
    283         strcpy(mountpoint_str, mountpoint_here);
    284         strcpy(format_str, format_here);
    285         strcpy(size_str, size_here);
    286 //      log_it ("Originals = %s,%s,%s,%s", device_str, mountpoint_str, format_str, size_str);
     207
     208        paranoid_free(device_str);
     209        asprintf(&device_str, device_here);
    287210        strip_spaces(device_str);
     211
     212        paranoid_free(format_str);
     213        asprintf(&format_str, format_here);
     214        strip_spaces(format_str);
     215
     216        paranoid_free(mountpoint_str);
     217        asprintf(&mountpoint_str, mountpoint_here);
    288218        strip_spaces(mountpoint_str);
    289         strip_spaces(format_str);
     219
     220        paranoid_free(size_str);
     221        asprintf(&size_str, size_here);
    290222        strip_spaces(size_str);
    291 //      log_it ("Modified = %s,%s,%s,%s", device_str, mountpoint_str, format_str, size_str);
     223
    292224        if (b_res == bOK) {
    293225            if (device_str[strlen(device_str) - 1] == '/') {
     
    308240        return;
    309241    }
    310     strcpy(drive_to_add, device_str);
     242    asprintf(&drive_to_add, device_str);
    311243    for (i = strlen(drive_to_add); isdigit(drive_to_add[i - 1]); i--);
    312244    num_to_add = atoi(drive_to_add + i);
    313245    drive_to_add[i] = '\0';
     246    paranoid_free(drive_to_add);
     247
    314248    currline = mountlist->entries;
    315249    strcpy(mountlist->el[currline].device, device_str);
    316250    strcpy(mountlist->el[currline].mountpoint, mountpoint_str);
     251    paranoid_free(mountpoint_str);
     252
    317253    strcpy(mountlist->el[currline].format, format_str);
     254    paranoid_free(format_str);
     255
    318256    mountlist->el[currline].size = atol(size_str) * 1024;
     257    paranoid_free(size_str);
     258
    319259    mountlist->entries++;
    320260    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) {
     
    322262                                    device_str);
    323263    }
     264    paranoid_free(device_str);
    324265    redraw_mountlist(mountlist, keylist, listbox);
    325266}
     
    336277
    337278    /** buffers ***********************************************************/
    338     char sz_out[MAX_STR_LEN];
     279    char *sz_out = NULL;
    339280
    340281    /** int ****************************************************************/
     
    344285    assert(raidrec != NULL);
    345286
    346     sz_out[0] = '\0';
    347287    if (popup_and_get_string
    348288        ("Add variable", "Enter the name of the variable to add", sz_out,
     
    396336
    397337    /** buffers ***********************************************************/
    398     char tmp[MAX_STR_LEN];
     338    char *tmp;
     339    char *devname;
    399340
    400341
     
    405346         && strcmp(raidlist->el[i].volname, basename(raid_device)); i++);
    406347    if (i == raidlist->entries) {
    407         sprintf(tmp,
     348        asprintf(&tmp,
    408349                "Cannot calc size of raid device %s - cannot find it in raidlist",
    409350                raid_device);
    410351        log_it(tmp);
     352        paranoid_free(tmp);
    411353        return (0);             // Isn't this more sensible than 999999999? If the raid dev !exists,
    412354        // then it has no size, right?
     
    420362        int k = 0, l = 0;
    421363        for (k = 0; k < raidrec->plex[j].subdisks; ++k) {
    422             char devname[64];
    423             strcpy(devname, raidrec->plex[j].sd[k].which_device);
     364            asprintf(&devname, raidrec->plex[j].sd[k].which_device);
    424365            for (l = 0; l < raidlist->disks.entries; ++l) {
    425366                if (!strcmp(devname, raidlist->disks.el[l].name)) {
     
    449390                }
    450391            }
     392            paranoid_free(devname);
    451393        }
    452394
     
    469411    }
    470412
    471     sprintf(tmp, "I have calculated %s's real size to be %ld", raid_device,
     413    asprintf(&tmp, "I have calculated %s's real size to be %ld", raid_device,
    472414            (long) smallest_plex);
    473415    log_it(tmp);
     416    paranoid_free(tmp);
    474417    return (smallest_plex);
    475418#else
     
    489432
    490433    /** buffers ***********************************************************/
    491     char tmp[MAX_STR_LEN];
     434    char *tmp;
    492435
    493436    assert(mountlist != NULL);
     
    499442         && strcmp(raidlist->el[i].raid_device, raid_device); i++);
    500443    if (i == raidlist->entries) {
    501         sprintf(tmp,
     444        asprintf(&tmp,
    502445                "Cannot calc size of raid device %s - cannot find it in raidlist",
    503446                raid_device);
    504447        log_it(tmp);
     448        paranoid_free(tmp);
    505449        return (999999999);
    506450    }
     
    525469        total_size = smallest_partition * (noof_partitions - 1);
    526470    }
    527     sprintf(tmp, "I have calculated %s's real size to be %ld", raid_device,
     471    asprintf(&tmp, "I have calculated %s's real size to be %ld", raid_device,
    528472            (long) total_size);
    529473    log_it(tmp);
     474    paranoid_free(tmp);
    530475    return (total_size);
    531476#endif
     
    550495
    551496    /** buffers ***********************************************************/
    552     char tmp[MAX_STR_LEN];
    553     char prompt[MAX_STR_LEN];
    554     char sz[MAX_STR_LEN];
    555 
    556     sprintf(prompt,
     497    char *tmp;
     498    char *prompt;
     499    char *sz;
     500
     501    asprintf(&prompt,
    557502            "Please enter the RAID level you want. (concat, striped, raid5)");
    558503    if (raidrec->raidlevel == -1) {
    559         strcpy(tmp, "concat");
     504        asprintf(&tmp, "concat");
    560505    } else if (raidrec->raidlevel == 0) {
    561         strcpy(tmp, "striped");
     506        asprintf(&tmp, "striped");
    562507    } else {
    563         sprintf(tmp, "raid%i", raidrec->raidlevel);
     508        asprintf(&tmp, "raid%i", raidrec->raidlevel);
    564509    }
    565510    for (out = 999; out == 999;) {
     
    570515        strip_spaces(tmp);
    571516        if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
    572             strcpy(sz, tmp);
     517            asprintf(&sz, tmp);
    573518            strncpy(tmp, sz + 1, strlen(sz) - 2);
    574519            tmp[strlen(sz) - 2] = '\0';
     520            paranoid_free(sz);
    575521        }
    576522        if (!strcmp(tmp, "concat")) {
     
    582528        }
    583529        log_it(tmp);
     530        paranoid_free(tmp);
    584531        if (is_this_raid_personality_registered(out)) {
    585532            log_it
     
    593540        }
    594541    }
     542    paranoid_free(prompt);
    595543    raidrec->raidlevel = out;
    596544#else
    597545    /** buffers ***********************************************************/
    598     char tmp[MAX_STR_LEN];
     546    char *tmp;
    599547    char personalities[MAX_STR_LEN];
    600     char prompt[MAX_STR_LEN];
    601     char sz[MAX_STR_LEN];
     548    char *prompt;
     549    char *sz;
    602550    int out = 0, res = 0;
    603551
     
    608556    strcpy(personalities,
    609557           last_line_of_file("/tmp/raid-personalities.txt"));
    610     sprintf(prompt, "Please enter the RAID level you want. %s",
     558    asprintf(&prompt, "Please enter the RAID level you want. %s",
    611559            personalities);
    612560    if (raidrec->raid_level == -1) {
    613         strcpy(tmp, "linear");
     561        asprintf(&tmp, "linear");
    614562    } else {
    615         sprintf(tmp, "%d", raidrec->raid_level);
     563        asprintf(&tmp, "%d", raidrec->raid_level);
    616564    }
    617565    for (out = 999;
     
    624572        strip_spaces(tmp);
    625573        if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
    626             strcpy(sz, tmp);
     574            asprintf(&sz, tmp);
    627575            strncpy(tmp, sz + 1, strlen(sz) - 2);
    628576            tmp[strlen(sz) - 2] = '\0';
     577            paranoid_free(sz);
    629578        }
    630579        if (!strcmp(tmp, "linear")) {
     
    636585        }
    637586        log_it(tmp);
     587        paranoid_free(tmp);
    638588        if (is_this_raid_personality_registered(out)) {
    639589            log_it
     
    647597        }
    648598    }
     599    paranoid_free(prompt);
    649600    raidrec->raid_level = out;
    650601#endif
    651602}
    652 
    653603
    654604
     
    672622
    673623    /** buffers ***********************************************************/
    674     char tmp[MAX_STR_LEN];
     624    char *tmp;
    675625
    676626    assert(mountlist != NULL);
     
    684634             pos++);
    685635        if (pos < mountlist->entries) {
    686             sprintf(tmp,
     636            asprintf(&tmp,
    687637                    "Deleting partition %s cos it was part of a now-defunct RAID",
    688638                    mountlist->el[pos].device);
    689639            log_it(tmp);
     640            paranoid_free(tmp);
    690641            memcpy((void *) &mountlist->el[pos],
    691642                   (void *) &mountlist->el[mountlist->entries - 1],
     
    695646    }
    696647}
    697 
    698648
    699649
     
    715665
    716666    /** buffers ***********************************************************/
    717     char tmp[MAX_STR_LEN];
     667    char *tmp;
    718668
    719669    assert(disklist != NULL);
    720670    assert_string_is_neither_NULL_nor_zerolength(raid_device);
    721671
    722     sprintf(tmp, "Delete %s from RAID device %s - are you sure?",
     672    asprintf(&tmp, "Delete %s from RAID device %s - are you sure?",
    723673            disklist->el[currline].device, raid_device);
    724674    if (!ask_me_yes_or_no(tmp)) {
     675        paranoid_free(tmp);
    725676        return;
    726677    }
     678    paranoid_free(tmp);
    727679    for (pos = currline; pos < disklist->entries - 1; pos++) {
    728680        /* memcpy((void*)&disklist->el[pos], (void*)&disklist->el[pos+1], sizeof(struct s_disk)); */
     
    731683    disklist->entries--;
    732684}
    733 
    734685
    735686
     
    754705
    755706    /** buffers ***********************************************************/
    756     char tmp[MAX_STR_LEN];
    757     char device[MAX_STR_LEN];
    758 
     707    char *tmp;
     708    char *device;
    759709
    760710    assert(mountlist != NULL);
     
    768718                                                  device);
    769719    if (pos >= 0) {
    770         sprintf(tmp, "Cannot delete %s: it is in use by RAID device %s",
     720        asprintf(&tmp, "Cannot delete %s: it is in use by RAID device %s",
    771721                mountlist->el[currline].device,
    772722                raidlist->el[pos].OSSWAP(raid_device, volname));
    773723        popup_and_OK(tmp);
     724        paranoid_free(tmp);
    774725        return;
    775726    }
    776     sprintf(tmp, "Delete %s - are you sure?",
     727    asprintf(&tmp, "Delete %s - are you sure?",
    777728            mountlist->el[currline].device);
    778729    if (!ask_me_yes_or_no(tmp)) {
     730        paranoid_free(tmp);
    779731        return;
    780732    }
     733    paranoid_free(tmp);
     734
    781735    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) {
    782         strcpy(device, mountlist->el[currline].device);
     736        asprintf(&device, mountlist->el[currline].device);
    783737        delete_raidlist_entry(mountlist, raidlist, device);
    784738        for (currline = 0;
     
    788742        if (currline == mountlist->entries) {
    789743            log_it("Dev is gone. I can't delete it. Ho-hum");
     744            paranoid_free(device);
    790745            return;
    791746        }
     747        paranoid_free(device);
    792748    }
    793749    memcpy((void *) &mountlist->el[currline],
     
    819775
    820776    /** buffers ***********************************************************/
    821     char tmp[MAX_STR_LEN];
     777    char *tmp;
    822778
    823779    assert(mountlist != NULL);
     
    829785        return;
    830786    }
    831     sprintf(tmp, "Do you want me to delete %s's partitions, too?", device);
     787    asprintf(&tmp, "Do you want me to delete %s's partitions, too?", device);
    832788    delete_partitions_too = ask_me_yes_or_no(tmp);
    833789    if (delete_partitions_too) {
     
    873829        items--;
    874830    }
     831    paranoid_free(tmp);
     832
    875833    raidlist->entries = items;
    876834}
     
    888846
    889847    /** buffers ************************************************************/
    890     char tmp[MAX_STR_LEN];
     848    char *tmp;
    891849
    892850    /** structures *********************************************************/
     
    896854
    897855    av = &raidrec->additional_vars;
    898     sprintf(tmp, "Delete %s - are you sure?", av->el[lino].label);
     856    asprintf(&tmp, "Delete %s - are you sure?", av->el[lino].label);
    899857    if (ask_me_yes_or_no(tmp)) {
    900858        if (!strcmp(av->el[lino].label, "persistent-superblock")
    901859            || !strcmp(av->el[lino].label, "chunk-size")) {
    902             sprintf(tmp, "%s must not be deleted. It would be bad.",
     860            paranoid_free(tmp);
     861            asprintf(&tmp, "%s must not be deleted. It would be bad.",
    903862                    av->el[lino].label);
    904863            popup_and_OK(tmp);
     
    908867        }
    909868    }
     869    paranoid_free(tmp);
    910870}
    911871#endif
     
    934894
    935895    /** buffers **********************************************************/
    936     static char current_filename[MAX_STR_LEN];
    937     char tmp[MAX_STR_LEN + 2];
     896    static char *current_filename;
     897    char *tmp;
    938898
    939899    /** bool *************************************************************/
     
    966926                if (!warned_already) {
    967927                    warned_already = TRUE;
    968                     sprintf(tmp,
     928                    asprintf(&tmp,
    969929                            "Too many lines. Displaying first %d entries only. Close a directory to see more.",
    970930                            ARBITRARY_MAXIMUM);
    971931                    popup_and_OK(tmp);
     932                    paranoid_free(tmp);
    972933                }
    973934            } else {
     
    988949                (g_strings_of_flist_window[i],
    989950                 g_strings_of_flist_window[i - 1]) < 0) {
    990                 strcpy(tmp, g_strings_of_flist_window[i]);
     951                asprintf(&tmp, g_strings_of_flist_window[i]);
    991952                strcpy(g_strings_of_flist_window[i],
    992953                       g_strings_of_flist_window[i - 1]);
    993954                strcpy(g_strings_of_flist_window[i - 1], tmp);
     955                paranoid_free(tmp);
     956
    994957                dummybool = g_is_path_selected[i];
    995958                g_is_path_selected[i] = g_is_path_selected[i - 1];
     
    1001964        newtListboxClear(listbox);
    1002965        for (i = 0; i < lines_in_flist_window; i++) {
    1003             sprintf(tmp, "%c%c %-80s", (g_is_path_selected[i] ? '*' : ' '),
     966            asprintf(&tmp, "%c%c %-80s", (g_is_path_selected[i] ? '*' : ' '),
    1004967                    (g_is_path_expanded[i] ? '+' : '-'),
    1005968                    strip_path(g_strings_of_flist_window[i]));
    1006             tmp[70] = '\0';
     969            // BERLIOS: this is dangerous now
     970            if (strlen(tmp) > 71) {
     971                tmp[70] = '\0';
     972            }
    1007973            keylist[i] = (void *) i;
    1008974            newtListboxAppendEntry(listbox, tmp, keylist[i]);
     975            paranoid_free(tmp);
    1009976        }
    1010977        return (lines_in_flist_window);
  • trunk/mondo/mondo/restore-scripts/Makefile.am

    r30 r181  
    11SUBDIRS = mondo usr
    22
    3 restoreetcdir       = $(pkgdatadir)/restore-scripts/etc
     3restoreetcdir       = $(pkglibdir)/restore-scripts/etc
    44restoreetc_DATA     = etc/multipath.conf.sample etc/raid0.conf.sample \
    55                      etc/raid1.conf.sample etc/raid4.conf.sample \
  • trunk/mondo/mondo/restore-scripts/mondo/Makefile.am

    r30 r181  
    1 restoremondodir      = $(pkgdatadir)/restore-scripts/mondo
     1restoremondodir      = $(pkglibdir)/restore-scripts/mondo
    22restoremondo_SCRIPTS = ISO ask-me-a-question compare-me compare-subroutine-me \
    33                       edit-mountlist grub-MR hack-fstab hack-grub hack-lilo hack-elilo \
  • trunk/mondo/mondo/restore-scripts/usr.bin/Makefile.am

    r30 r181  
    1 restoreusrbindir      = $(pkgdatadir)/restore-scripts/usr/bin
     1restoreusrbindir      = $(pkglibdir)/restore-scripts/usr/bin
    22#restoreusrbin_SCRIPTS = # petris pico nano
  • trunk/mondo/mondo/restore-scripts/usr/bin/Makefile.am

    r30 r181  
    1 restoreusrbindir      = $(pkgdatadir)/restore-scripts/usr/bin
     1restoreusrbindir      = $(pkglibdir)/restore-scripts/usr/bin
    22#restoreusrbin_SCRIPTS = petris nano
Note: See TracChangeset for help on using the changeset viewer.