modify opertion part against first review
This commit is contained in:
qin bo
2010-10-12 14:17:03 +08:00
parent aab61720ee
commit 0b29c12bcd
12 changed files with 208 additions and 186 deletions

View File

@@ -11,10 +11,3 @@ done
rm $pkg_dir/*-serv.conf
#
#
# Destroy itself
#
rm -f $0

View File

@@ -6,8 +6,8 @@
#
# Input:
# argument:
# [-r|--root] partition mount by root
# <-b|--boot> partition mount by boot (optional,if the boot is not mount by stand alone)
# <-r|--root> partition mount by root
# [-b|--boot] partition mount by boot (optional,if the boot is not mount by stand alone)
# [-k|--kparameter] kernel parameter
# [-o|--osversion] OS version
#
@@ -51,9 +51,9 @@ Usage: $0 options
options:
[--help] show this message
[-t|--type ] boot loader type:grub,etc.
[-r|--root] partition mount by root
<-b|--boot> partition mount by boot (optional,if the boot is not mount by stand alone)
<-t|--type > boot loader type:grub,etc.
<-r|--root> partition mount by root
[-b|--boot] partition mount by boot (optional,if the boot is not mount by stand alone)
[-k|--kparameter] kernel parameter
[-o|--osversion] OS version
"
@@ -77,22 +77,20 @@ configure_grub_cnf ()
# get the boot directory in which hard disk
if [ -n "$BOOT_PARTITION" ];then
root_hd=$(echo "$BOOT_PARTITION"|sed 's/[0-9]//g')
root_hd=${BOOT_PARTITION%%[0-9]*}
part_num=${BOOT_PARTITION##*[a-z]}
let $((part_num-=1))
else
root_hd=$(echo "$ROOT_PARTITION"|sed 's/[0-9]//g')
root_hd=${ROOT_PARTITION%%[0-9]*}
part_num=${ROOT_PARTITION##*[a-z]}
let $((part_num-=1))
fi
if [ ! -e "$DEVICEMAP" ];then
warn "$DEVICEMAP doesn't exist, creat it"
info "generate $DEVICEMAP"
# generate device.map
grub --batch --no-floppy --device-map="$DEVICEMAP" << EOF 1>>"$DEV_LOG" 2>&1
quit
EOF
fi
hd_dev=$(grep "$root_hd" "$DEVICEMAP" | awk '{print $1}' | sed 's/(//' | sed 's/)//') #e.g. hd_dev=hd0
info "hd_dev: $hd_dev part_num: $part_num"

View File

@@ -23,7 +23,8 @@
# Output:
# NULL
# Returne value:
# 1 fstab doesn't exist
# 1 argument error
# 2 fstab doesn't exist
#
# AUTHOR: Qin Bo
#
@@ -51,48 +52,45 @@ configure_fstab ()
# store uuid or by-id
local devname=""
if [ $# -lt 3 ];then
err "$FUNCNAME function argument error, it need 3 arguments at least !"
return 1
fi
# in Rocky4.2 udev-117: udevinfo couldn't get by-id of raid,
# also couldn't get by-uuid of swap, raid and swap can't unification ,
# so get device's uuid expect swap, only get device's by-id for swap.
# if partition not exist, or couldn't get partition information
# set $devname as default
if [ "$mountpoint" == "swap" -a "$fs_type" == "swap" ];then
by_id=$(get_disk_sym $device "by-id")
if [ -n "$by_id" ];then
devname="/dev/$by_id"
else
devname="$device"
fi
# get partition's UUID, if partition not exist,
# or couldn't get partition information, set $devname as default
by_uuid=$(get_disk_sym $device "by-uuid")
if [ -n "$by_uuid" ];then
devname="UUID=$(echo $by_uuid|sed 's/.*\///')"
else
by_uuid=$(get_disk_sym $device "by-uuid")
if [ -n "$by_uuid" ];then
devname="UUID=$(echo $by_uuid|sed 's/.*\///')"
else
devname="$device"
fi
devname="$device"
fi
# configure fstab options here
# fs_mntops, fs_freq, fs_passno has given, we use function argument,
# or we set default configuration, this default configuration according
# to old Rocky installer.
# or we set default configuration, set fs_freq 0, because our OS haven't
# dump utility, set root device of fs_passno 1. root device must first check.
# other device set 0.
case $fs_type in
ext2|ext3|reiserfs)
[ -z "$fs_mntops" ] && fs_mntops="acl"
[ -z "$fs_freq" ] && fs_freq=1
[ -z "$fs_passno" ] && fs_passno=1 ;;
;;
swap)
[ -z "$fs_mntops" ] && fs_mntops="defaults"
[ -z "$fs_freq" ] && fs_freq=0
[ -z "$fs_passno" ] && fs_passno=0 ;;
;;
*)
[ -z "$fs_mntops" ] && fs_mntops="defaults"
[ -z "$fs_freq" ] && fs_freq=1
[ -z "$fs_passno" ] && fs_passno=1 ;;
;;
esac
[ -z "$fs_freq" ] && fs_freq=0
if [ "$mountpoint" == "/" ];then
[ -z "$fs_passno" ] && fs_passno=1
else
[ -z "$fs_passno" ] && fs_passno=0
fi
info "$devname $mountpoint $fs_type $fs_mntops $fs_freq $fs_passno"
printf "%-60s %-10s %-10s %-25s %-1s %-1s\n" $devname $mountpoint $fs_type $fs_mntops $fs_freq $fs_passno >>"$TARGET/etc/fstab"
@@ -118,7 +116,7 @@ main ()
info "configure fstab success"
else
err "$TARGET/etc/fstab doesn't exist"
exit 1
exit 2
fi
}

View File

@@ -6,26 +6,26 @@
#
# Input: argument
# [--help] show usage
# [-t|--type] "static" or "dynamic"
# <-t|--type> "static" or "dynamic"
# static argument:
# [-h|--hostname] hostname
# [-i|--ip] ip address
# [-n|--netmask] netmask
# [-g|--gateway] gateway
# <-h|--hostname> hostname
# <-i|--ip> ip address
# <-n|--netmask> netmask
# <-g|--gateway> gateway
# <-d|--domainname> domainname
# <-p|--pdns> priamaryDNS
# <-s|--sdns> secondaryDNS
# <-e|--device> network device. if no configure, default is eth0.
# [-p|--pdns] priamaryDNS
# [-s|--sdns] secondaryDNS
# [-e|--device] network device. if no configure, default is eth0.
# dynamic argument:
# [-h|--hostname] hostname
# <-e|--device> network device. if no configure, default is eth0.
# <-h|--hostname> hostname
# [-e|--device] network device. if no configure, default is eth0.
#
# Output:
# NULL
# Return value:
# 1 argument error
# 2 ip/netmask/gateway address incorrect
# 3 hosts/resolv.conf/ifcfg-eth0/network doesn't exist
# 3 hosts/resolv.conf/ifcfg.template/network doesn't exist
#
# AUTHOR: Qin Bo
#
@@ -59,19 +59,19 @@ Usage: $0 options:
options:
[--help] show this message
[-t|--type] \"static\" or \"dynamic\"
<-t|--type> \"static\" or \"dynamic\"
static argument:
[-h|--hostname] hostname
[-i|--ip] ip address
[-n|--netmask] netmask
[-g|--gateway] gateway
<-d|--domainname> domainname
<-p|--pdns> priamaryDNS
<-s|--sdns> secondaryDNS
<-e|--device> network device. if no configure, default is eth0.
<-h|--hostname> hostname
<-i|--ip> ip address
<-n|--netmask> netmask
<-g|--gateway> gateway
[-d|--domainname] domainname
[-p|--pdns] priamaryDNS
[-s|--sdns] secondaryDNS
[-e|--device] network device. if no configure, default is eth0.
dynamic argument:
[-h|--hostname] hostname
<-e|--device> network device. if no configure, default is eth0.
<-h|--hostname> hostname
[-e|--device] network device. if no configure, default is eth0.
"
return $ret
}
@@ -80,7 +80,7 @@ check_ip ()
{
if [ $# -ne 1 ];then
err "$FUNCNAME function argument error, it must be 1"
err "$FUNCNAME function argument error, it must 1 argument !"
return 1;
fi
@@ -214,89 +214,103 @@ parse_arg ()
}
configure_network ()
# configure /etc/hosts
configure_hosts ()
{
if [ "$TYPE" == "static" ];then
# configure /etc/hosts
if [ -e "$TARGET/etc/hosts" ];then
if [ -e "$TARGET/etc/hosts" ];then
if [ "$TYPE" == "static" ];then
sed -i "s/^#<ip-address>/$IP/
s/<HOSTNAME.domain.org>/$HOSTNAME\.$DOMAINNAME/
s/<HOSTNAME>/$HOSTNAME/" "$TARGET/etc/hosts"
else
err "$TARGET/etc/hosts doesn't exist"
return 3
s/<hostname\.domain\.org>/$HOSTNAME\.$DOMAINNAME/
s/<hostname>/$HOSTNAME/" "$TARGET/etc/hosts"
elif [ "$TYPE" == "dynamic" ];then
printf "%s\n" $HOSTNAME >> "$TARGET/etc/hosts"
fi
else
err "$TARGET/etc/hosts doesn't exist"
return 3
fi
}
# configure /etc/resolv.conf
if [ -e "$TARGET/etc/resolv.conf" ];then
sed -i "s/^#search <domain.org>$/search $DOMAINNAME/
s/^#domain <domain.org>$/domain $DOMAINNAME/" "$TARGET/etc/resolv.conf"
# configure /etc/resolv.conf
configure_resolv_conf ()
{
if [ -e "$TARGET/etc/resolv.conf" ];then
if [ "$TYPE" == "static" ];then
sed -i "s/^#search <domain\.org>$/search $DOMAINNAME/
s/^#domain <domain\.org>$/domain $DOMAINNAME/" "$TARGET/etc/resolv.conf"
if [ -n "$primaryDNS" ];then
sed -i "s/^#nameserver <ip-address>$/nameserver $primaryDNS/" "$TARGET/etc/resolv.conf"
fi
if [ -n "$secondaryDNS" ];then
sed -i "/nameserver/a\nameserver $secondaryDNS" "$TARGET/etc/resolv.conf"
fi
else
err "$TARGET/etc/resolv.conf doesn't exist"
return 3
fi
# configure /etc/sysconfig/network-devices/ifcfg-eth0
if [ -e "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0" ];then
broadcast=$(./ipcalc.pl -n $IP/$NETMASK| grep Broadcast|awk '{ print $2 }')
sed -i '/IPADDR/ c\IPADDR='$IP'
/NETMASK/ c\NETMASK='$NETMASK'
/DEVICE/ c\DEVICE='$DEVICE'
/GATEWAY/ c\GATEWAY='$GATEWAY'
/BROADCAST/ c\BROADCAST='$broadcast'' "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0"
else
err "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0 doesn't exist"
return 3
fi
# configure /etc/sysconfig/network
if [ -e "$TARGET/etc/sysconfig/network" ];then
sed -i '/HOSTNAME/ c\HOSTNAME='$HOSTNAME'' "$TARGET/etc/sysconfig/network"
printf "DOMAIN=%s\n" "$DOMAINNAME" >>"$TARGET/etc/sysconfig/network"
else
err "$TARGET/etc/sysconfig/network doesn't exist"
return 3
fi
else [ "$TYPE" == "dynamic" ]
# configure /etc/hosts
if [ -e "$TARGET/etc/hosts" ];then
printf "%s\n" $HOSTNAME >> "$TARGET/etc/hosts"
else
err "$TARGET/etc/hosts doesn't exist"
return 3
fi
# configure /etc/sysconfig/network-devices/ifcfg-eth0
if [ -e "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0" ];then
sed -i '/BOOTPROTO/ c\BOOTPROTO=dhcp
/DEVICE/ c\DEVICE='$DEVICE'
/SERVICE/ c\SERVICE=dhcpcd
/IPADDR/ c\IPADDR=
/NETMASK/ c\NETMASK=
/GATEWAY/ c\GATEWAY=
/BROADCAST/ c\BROADCAST=' "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0"
else
err "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0 doesn't exist"
return 3
fi
# configure /etc/sysconfig/network
if [ -e "$TARGET/etc/sysconfig/network" ];then
sed -i '/HOSTNAME/ c\HOSTNAME='$HOSTNAME'' "$TARGET/etc/sysconfig/network"
else
err "$TARGET/etc/sysconfig/network doesn't exist"
return 3
fi
else
err "$TARGET/etc/resolv.conf doesn't exist"
return 3
fi
if [ "$DEVICE" != "eth0" ];then
mv "$TARGET/etc/sysconfig/network-devices/ifcfg-eth0" "$TARGET/etc/sysconfig/network-devices/ifcfg-$DEVICE"
}
# configure /etc/sysconfig/network-devices/ifcfg.$DEVICE
configure_ifcfg ()
{
if [ -e "$IFCFG_TEMP" ];then
if [ "$TYPE" == "static" ];then
SERVICE="ipv4-static"
BOOTPROTO="none"
BROADCAST=$(./ipcalc.pl -n $IP/$NETMASK| grep Broadcast|awk '{ print $2 }')
NETWORK=$(./ipcalc.pl -n $IP/$NETMASK| grep Network|awk '{ print $2 }'|cut -d "/" -f 1)
elif [ "$TYPE" == "dynamic" ];then
SERVICE="dhcpcd"
BOOTPROTO="dhcp"
IP=""
NETMASK=""
GATEWAY=""
BROADCAST=""
NETWORK=""
fi
sed "/DEVICE/ c\DEVICE=$DEVICE
/BOOTPROTO/ c\BOOTPROTO=$BOOTPROTO
/SERVICE/ c\SERVICE=$SERVICE
/IPADDR/ c\IPADDR=$IP
/NETMASK/ c\NETMASK=$NETMASK
/GATEWAY/ c\GATEWAY=$GATEWAY
/BROADCAST/ c\BROADCAST=$BROADCAST
/NETWORK/ c\NETWORK=$NETWORK
" "$IFCFG_TEMP" >"$NETWORK_DEVICES_DIR/ifcfg-$DEVICE"
else
err "$IFCFG_TEMP doesn't exist"
return 3
fi
}
# configure /etc/sysconfig/network
configure_network_file ()
{
if [ -e "$SYSCONFIG_DIR/network" ];then
if [ "$TYPE" == "static" ];then
sed -i "/HOSTNAME/ c\HOSTNAME=$HOSTNAME" "$SYSCONFIG_DIR/network"
printf "DOMAIN=%s\n" "$DOMAINNAME" >>"$SYSCONFIG_DIR/network"
elif [ "$TYPE" == "dynamic" ];then
sed -i "/HOSTNAME/ c\HOSTNAME=$HOSTNAME" "$TARGET/etc/sysconfig/network"
fi
else
err "$SYSCONFIG_DIR/network doesn't exist"
return 3
fi
}
configure_network ()
{
configure_hosts
configure_resolv_conf
configure_ifcfg
configure_network_file
}
main ()
@@ -304,7 +318,7 @@ main ()
info "configure network"
parse_arg "$@"
erv
configure_network
configure_network
erv
info "configure network success"
}
@@ -318,6 +332,14 @@ GATEWAY=""
primaryDNS=""
secondaryDNS=""
DEVICE=""
SERVICE=""
BROADCAST=""
BOOTPROTO=""
NETWORK=""
SYSCONFIG_DIR="$TARGET/etc/sysconfig"
NETWORK_DEVICES_DIR="$SYSCONFIG_DIR/network-devices"
IFCFG_TEMP="$NETWORK_DEVICES_DIR/ifcfg.template"
# The quotes around '$@' are essential!
# in this way we can accept whitespace as parameter.

View File

@@ -5,8 +5,7 @@
# SCRIPT NAME: copy_kernel.sh
#
# Input: stdin
# 1.
# 2.
# NULL
#
# Output:
# NULL

View File

@@ -39,7 +39,7 @@ source ./functions
format_partition ()
{
if [ $# -ne 2 ];then
err "$FUNCNAME function argument error, it must be 2 !"
err "$FUNCNAME function argument error, it must have 2 arguments !"
return 1
fi
@@ -77,7 +77,6 @@ format_partition ()
;;
swap)
mkswap -f "$devname" 1>>"$DEV_LOG" 2>&1
swapon "$devname"
;;
fat)
mkfs.vfat "$devname" 1>>"$DEV_LOG" 2>&1

View File

@@ -67,32 +67,37 @@ erv ()
# recursively umount directory,
# argument can be a device node or mountpoint.
# if argument is a device node can umount a device which mounted multi-directory,
# if argument is a mountpoint can't umount a device recursively, only recursively directory.
# if argument is a device node:
# 1.if a device be mounted on a directory, then umount this device's mountpoint,
# if a device has been mounted on this mountpoint's subdirectory, then recurisve
# umount device of this subdirectory , finally, umount the device that you want
# be umounted.
# 2.if have a device has been mounted on multi-direcetory, then umount these
# direcectories one by one, use method 1.
# if argument is a mountpoint, then umount this mountpoint, if have device has been mounted on
# this mountpoint's subdirectory, the recursively umount subdirectory, finally umount the directory.
# ex: 1.reumount /dev/hda5
# 2.reumount /mnt/
reumount ()
{
if [ $# -ne 1 ];then
err "$FUNCNAME function argument error, it must be 1 !"
err "$FUNCNAME function argument error, it must have 1 argument !"
return 1
fi
local arg
arg="$1"
local mountpoint
local multi_mountpoint
# if arg is a device node
if [ ! -d "$arg" ];then
mountpoint=$(grep "^$arg " /proc/mounts|awk '{print $2}')
multi_mountpoint=$(grep "^$arg " /proc/mounts|awk '{print $2}')
else
mountpoint="$arg"
# delete last "/" in mountpoint
# mountpoint in /proc/mounts don't have "/" at last
multi_mountpoint=$(echo arg|sed "s%/$%%")
fi
# delete last "/" in mountpoint
# mountpoint in /proc/mounts don't have "/" at last
multi_mountpoint=$(echo $mountpoint|sed "s%/$%%")
# may be a device has been mounted in multi-mountpoint.
# ex: /dev/hda5 mount at /mnt and /cdrom at the same time,
# this case appear when $TARGET has been changed, when mount paritions.
@@ -121,7 +126,7 @@ update_udev()
get_disk_sym ()
{
if [ $# -ne 2 ];then
err "$FUNCNAME function argument error, it must be 2 !"
err "$FUNCNAME function argument error, it must have 2 argument !"
return 1
fi

View File

@@ -31,7 +31,8 @@ mount_partition.sh
success:
@ mount $devname success
返回值:
1 device node doesn't exist
1 argument error
2 device node doesn't exist
32 mount failure
Usage
单个处理echo "/dev/sda1 / ext3" |./mount_partition.sh
@@ -44,7 +45,7 @@ Usage
1. pkgname
argument:
[--help] show usage
<-s|--source> package source directory, if not specify, default is /Rocky/packages.
[-s|--source] package source directory, if not specify, default is /Rocky/packages.
输出: sucess:
@ install $pkgname success.
返回值:
@@ -74,7 +75,8 @@ Usage
输出:
返回值:
1 fstab doesn't exist
1 argument error
2 fstab doesn't exist
Usage
单个处理echo "/dev/hda2 /home ext3"|./configure_fstab.sh
批量处理:文件格式和单个处理一致
@@ -104,20 +106,19 @@ generate_issue.sh
configure_network.sh
输入:
argument
[-t|--type] "static" or "dynamic"
<-t|--type> "static" or "dynamic"
static argument:
[-h|--hostname] hostname
[-i|--ip] ip address
[-n|--netmask] netmask
[-g|--gateway] gateway
<-h|--hostname> hostname
<-i|--ip> ip address
<-n|--netmask> netmask
<-g|--gateway> gateway
<-d|--domainname> domainname
<-p|--pdns> priamaryDNS
<-s|--sdns> secondaryDNS
<-e|--device> network device. if no configure, default is eth0.
[-p|--pdns] priamaryDNS
[-s|--sdns] secondaryDNS
[-e|--device] network device. if no configure, default is eth0.
dynamic argument:
[-h|--hostname] hostname
<-e|--device> network device. if no configure, default is eth0.
<-h|--hostname> hostname
[-e|--device] network device. if no configure, default is eth0.
输出:
返回值:
@@ -170,9 +171,9 @@ configure_bootloader_cnf.sh
输入:
arguments:
[--help] show this message
[-t|--type ] boot loader type:grub,etc.
[-r|--root] partition mount by root
<-b|--boot> partition mount by boot (optional,if the boot is not mount by stand alone)
<-t|--type> boot loader type:grub,etc.
<-r|--root> partition mount by root
[-b|--boot] partition mount by boot (optional,if the boot is not mount by stand alone)
[-k|--kparameter] kernel parameter
[-o|--osversion] OS version
输出:
@@ -191,7 +192,7 @@ install_bootloader.sh
输入:
arguments:
[--help] show this message
[-t|--type] boot loader type:grub,etc.
<-t|--type> boot loader type:grub,etc.
输出:
返回值:

View File

@@ -6,7 +6,7 @@
#
# Input:
# [--help] show this message
# [-t|--type] boot loader type:grub,etc.
# <-t|--type> boot loader type:grub,etc.
# Output:
# NULL
# Return value:
@@ -46,7 +46,7 @@ Usage: $0 options
options:
[--help] show this message
[-t|--type] boot loader type:grub, etc.
<-t|--type> boot loader type:grub, etc.
"
return $ret

View File

@@ -11,7 +11,7 @@
# 1. pkgname
# argument:
# [--help] show usage
# <-s|--source> package source directory, if not specify, default is /Rocky/packages.
# [-s|--source] package source directory, if not specify, default is /Rocky/packages.
#
# Output:
# sucess:
@@ -67,7 +67,7 @@ Usage: $0 options
options:
[--help] show this message
<-s|--source> package source directory, if not specify, default is /Rocky/packages.
[-s|--source] package source directory, if not specify, default is /Rocky/packages.
(ex: echo make|install_pkg.sh -s /Rocky/packages)
"
@@ -78,7 +78,7 @@ options:
get_pkg_file ()
{
if [ $# -ne 1 ];then
err "$FUNCNAME function argument error , it must be 1 !"
err "$FUNCNAME function argument error , it must 1 argument !"
return 1
fi
@@ -96,7 +96,7 @@ get_pkg_file ()
add_pkg ()
{
if [ $# -ne 1 ];then
err "$FUNCNAME function argument error , it must be 1 !"
err "$FUNCNAME function argument error , it must have 1 argument!"
return 1
fi
@@ -108,7 +108,7 @@ add_pkg ()
install_pkg ()
{
if [ $# -ne 1 ];then
err "$FUNCNAME function argument error , it must be 1 !"
err "$FUNCNAME function argument error , it must have 1 argument!"
return 1
fi
@@ -124,7 +124,7 @@ install_pkg ()
db="$TARGET$db_dir/db"
if [ ! -e "$db" ];then
info "create $TARGET$db_dir ..."
info "create $db ..."
mkdir -p "$TARGET$db_dir"
touch "$db"
fi

View File

@@ -40,7 +40,7 @@ make_sysmbol_link ()
{
if [ $# -ne 2 ];then
err "$FUNCNAME function argument error, it must be 2 !"
err "$FUNCNAME function argument error, it must have 2 argument!"
return 1
fi
@@ -71,7 +71,7 @@ make_sysmbol_link ()
gen_serv_cnf ()
{
if [ $# -ne 2 ];then
err "$FUNCNAME function argument error, it must be 2 !"
err "$FUNCNAME function argument error, it must have 2 argument!"
return 1
fi

View File

@@ -18,7 +18,8 @@
# success:
# @ mount $devname success
# Return value:
# 1 device node doesn't exist
# 1 argument error
# 2 device node doesn't exist
# 32 mount failure
#
# AUTHOR: Qin Bo
@@ -43,11 +44,17 @@ mount_partition ()
local mountpoint="$2"
local fs_type="$3"
local fs_mntops="$4"
if [ $# -lt 3 ];then
err "$FUNCNAME function argument error, it need 3 arguments at least !"
return 1
fi
local mount_pos="$TARGET$mountpoint"
if [ ! -e "$devname" ];then
err "$devname node doesn't exist !"
return 1
return 2
fi
# mount filesystem for default option,
@@ -68,7 +75,7 @@ mount_partition ()
# device node has already mounted on other directory, umount it.
# ex: /dev/hda5 should mount on /mnt, but it has already mounted on /cdrom before,
# so, we umount it
if [ "$(grep "$devname" /proc/mounts|awk '{print $2}')" != "$mount_pos" ];then
if grep -q "^$devname " /proc/mounts;then
reumount $devname
fi