Author Topic: (Solved) Bash Challenge to Bash Guru's  (Read 1528 times)

VastOne

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
(Solved) Bash Challenge to Bash Guru's
« on: November 03, 2013, 08:18:40 PM »
I am working on removing swap from the VSIDO installer as it is more of a nuisance than a help

I have ran into a issue with removing it that I am hoping some of you Bash guru's can assist with

The installer is a basic bash script and here is the issue... I have included only the pertinent part

Code: [Select]
if [ "$PARTDRIVE" = "Exit" ];

$PARTITIONPROG /dev/$PARTDRIVE

#find the swap partition
#TARGETSWAP=`fdisk -l | grep swap | awk '{print $1}' | cut -d "/" -f3`
#TARGETSWAP=`echo $TARGETSWAP | sed -r "s/\/dev\///g"`
#for i in $TARGETSWAP; do
# swappart="$i"
# swappartsize=`grep -m 1 "$i" /proc/partitions | awk '{print $3}'`
# swappartmenu="$swappartmenu $swappart $swappartsize"
#done

#SWAP=""
#while [ "$SWAP" = "" ]
#do
#SWAP=`$DIALOGMENU $TITLE"$TITLETEXT" $MENU  $TEXT"Please select a swap partition to use.\nIf the only option you see is to Quit the installer then no swap partitions were found." Exit "Quit the installer" $swappartmenu`
#done

#SWAP=`echo $SWAP | cut -d "|" -f 1`

#if [ "$SWAP" = "Exit" ]; then
#  $DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"Quitting the installer now."
#  exit 1
#fi
#choose the partition to install to
CKLIVE=`mount | grep "live" | grep -v "loop" | awk '{print $1}' | awk -F "/" '{print $3}'`
PARTITIONS=`cat /proc/partitions | grep -v "$CKLIVE" | grep -v "loop" | grep -v "sr0" | awk '{print $4}' | grep "[0-9]"`
PARTINSTTEMP=`echo $PARTITIONS | sed -r "s/$SWAP//"`
PARTINST=`echo $PARTINSTTEMP`
for i in $PARTINST; do
tempsize=`grep -m 1 "$i" /proc/partitions | awk '{print $3}'`
if [ "$tempsize" = "1" ]; then
PARTINST=`echo $PARTINST | sed -r "s/$i//"`
fi
done


for i in $PARTINST; do
  part="$i"
  partsize=`grep -m 1 "$i" /proc/partitions | awk '{print $3}'`
  partmenu="$partmenu $part $partsize"
done

TARGETPART=""
while [ "$TARGETPART" = "" ]
do
TARGETPART=`$DIALOGMENU $TITLE"$TITLETEXT" $MENU  $TEXT"Please select a partition to install the root system to.\nIf the only option you see is to Quit the installer then no partitions were found." Exit "Quit the installer" $partmenu`
done

TARGETPART=`echo $TARGETPART | cut -d "|" -f 1`

if [ "$TARGETPART" = "Exit" ]; then
  $DIALOG $TITLE"$TITLETEXT" $MSGBOX $TEXT"Quitting the installer now."
  exit 1
fi

What you see commented out in the beginning is the removal of swap from the script.  This in fact works but creates another issue that I have spent all morning trying to identify and it is escaping my wisdom

The second half is where a user would create the partition to install / (root) on.  When the swap part is commented out, there is no partition shown to install / to.  If I put the swap stuff back in, every thing works as it should

The challenge is for anyone to identify why and what the correction would be

If you want the entire bash installer, let me know

Thanks

VastOne
VSIDO      VSIDO Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

VastOne

  •      v-ger
  • Posts: 3964
    • View Profile
    • VSIDO Community
Re: Bash Challenge to Bash Guru's
« Reply #1 on: November 03, 2013, 09:15:26 PM »
aiBo' solved this for me on the IRC with the following

changing

Code: [Select]
PARTINSTTEMP=`echo $PARTITIONS | sed -r "s/$SWAP//"`
to

Code: [Select]
PARTINSTTEMP=`echo $PARTITIONS`
Thanks aiBo'!
VSIDO      VSIDO Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

TeoBigusGeekus

  • Posts: 3
    • View Profile
Re: (Solved) Bash Challenge to Bash Guru's
« Reply #2 on: November 04, 2013, 05:57:14 PM »
Glad you've found it VastOne!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!