iccaros Posted November 7, 2004 Report Share Posted November 7, 2004 ok I'm writing this install script .. you can see I have functions that do somethings (most are not done).. what I am having a problem with is the last 8 lines.. the if statments for the menu.. I have tried if and elif but it only takes options 1 the rest it ignores.. I have no clue why..I now made mutiple if statments.. but still same thing..also tried (as you can see) to change numbers for letter.. no work. the partition (option 1) is the only one working. thanks for any help#!/bin/bash#this is the start to a installation program for my linux distro#Author: William Huskey <[email protected]># Some functions come from Tomas Matejicek <http://slax.linux-live.org> slax install script as noted above function. # copywrite 2004 under the GPL www.gnu.org for a copy#create temp variableTMPFILE=/tmp/steve-installer-tmprm -f $TMPFILEDISK="hda"#begin with header informationclearecho "This Program will assist you in installing Steve Linux to your hard drive."echo "Please answer the questions and this will be a simple process."echo "are you ready Y/n"read a #this is just a pause to let the user read the output aboveif [ "$a" = "n" ]; then echo quit installer exitfithis will start the main part of the install programfunction menu() { clear echo "There are severl things need to be done to install a Operating system." echo "the following will allow you to do so" echo "1. Partition harddrive" echo "2. format Partition" echo "3. IF you already have a formated partiton before starting pick me" echo "4. install OS" read Menu_choice }#This Function will format a partition for swap function swap (){ mkswap /dev/$Swap swapon /dev/$Swap}#This function will format the correct partitionfunction format (){ echo choose which format you will use echo 1. reiserfs echo 2. ext2 echo 3. ext3 read FMAT mkfs.$FMAT /dev/$HD} #This is the function to partition your harddrivefunction partition (){ /usr/sbin/cfdisk /dev/$DISK menu}#this function will make the install folder and mount itfunction mnt (){ mkdir /mnt/install DEST="/mnt/install" mount /dev/$HD /mnt/$DEST}# This function will allow you to choose what partition the user already has will be used# this function is derived from the Slax-install scriptfunction Usr_Pik (){if [ "$1" = "" -o ! -d "$1" ]; then ls -aA1bd /mnt/* | while read LINE; do MOUNT=`mount | egrep -v "\(.*bind.*\)" | egrep -v "\(.*loop.*\)" | grep -F "$LINE" | cut -d " " -f 1` if [ ! "$MOUNT" = "" ]; then echo -n "$LINE $MOUNT " >>$TMPFILE fi done if [ "`cat $TMPFILE 2>/dev/null`" = "" ]; then error "You have to mount your partition to /mnt/something first. Try 'mntall' script."; fi dialog --title "Steve Linux Hard Drive Chooser" --menu \"BEFORE YOU START:\n\Prepare your disk partition for example by using cfdisk\n\and make ext2 or ext3 or reiserfs or xfs filesystem on it.\n\Then mount it somewhere in /mnt/ or reboot Steve Linux\n\to mount it automatically.\n\n\All partitions available right now are listed below.\n\Choose your target partition:\n" 0 0 0 `cat $TMPFILE` 2>$TMPFILE if [ ! "$?" = 0 ]; then exit; fi $0 `cat $TMPFILE` rm -f $TMPFILE exitfiexit}menuif [ "$Menu_choice" = "1" ]; then echo partition partitionfiif ["$Menu_choice" = "f" ]; thenexit #formatfiif ["$Menu_choice" = "3" ]; thenUsr_Pikfiif ["$Menu_choice" = "4" ];thenexitelsemenufiexit Quote Link to post Share on other sites
iccaros Posted November 7, 2004 Author Report Share Posted November 7, 2004 changed to case statments now works.. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.