📄 remove.sh
字号:
#! /bin/sh## This script is responsible for uninstalling the iSCSI driver#BINDIRS="${ROOT}/sbin ${ROOT}/sbin"MANDIRS="${ROOT}/man ${ROOT}/man"KVER=`uname -r`if [ `whoami` != root ]; then echo "You must be root to remove the device driver!" exit 1fiecho "Removing iSCSI driver for Linux $KVER"echo " "# find dirs that might contain driver filesfor initdir in ${ROOT}/etc/rc.d/init.d ${ROOT}/etc/init.ddo if [ -x $initdir/iscsi ]; then # try to find where the relocatable files were installed DIR=`awk -F= '$1=="BASEDIR" { print $2}' $initdir/iscsi` BINDIRS="$BINDIRS ${ROOT}$DIR/sbin" MANDIRS="$MANDIRS ${ROOT}$DIR/man" fidone# stop the driver if it's runningfor initdir in ${ROOT}/etc/rc.d/init.d ${ROOT}/etc/init.ddo if [ -x $initdir/iscsi ]; then $initdir/iscsi stop break fidone# shutdown all sessions in the kernel modulefor hba in /sys/class/scsi_host/*; do if [ -f $hba/proc_name ]; then name=`awk '{print $1}' < $hba/proc_name` if [ $name == "iscsi-sfnet" ]; then echo > $hba/shutdown fi fidone# ensure all the kernel threads are really deadkillall -9 iscsi-rx > /dev/null 2>&1killall -9 iscsi-timer > /dev/null 2>&1# Unload and remove the iSCSI kernel modulermmod iscsi_sfnet > /dev/null 2>&1for dir in ${ROOT}/lib/modules ${ROOT}/usr/lib/modules ${ROOT}/lib/modules/$KVER/miscdo if [ -f $dir/iscsi_sfnet.ko ] ; then rm -f $dir/iscsi_sfnet.ko fi # remove the old name as well if [ -f $dir/iscsi_mod.o ] ; then rm -f $dir/iscsi_mod.o fidone## Remove the init.d script and links#for initdir in ${ROOT}/etc/rc.d/init.d ${ROOT}/etc/init.d ${ROOT}/etc/rc.ddo if [ -d $initdir ]; then for dir in `ls -d $initdir/rc*.d 2> /dev/null` do if [ -d $dir ] ; then for file in `ls $dir/*iscsi 2> /dev/null | egrep '(S|K)[0-9]+iscsi'` do rm -f $file done fi done fidonefor initdir in ${ROOT}/etc/rc.d/init.d ${ROOT}/etc/init.d ${ROOT}/etc/rc.ddo if [ -f $initdir/iscsi ] ; then rm -f $initdir/iscsi fi if [ -f $initdir/rc.iscsi ] ; then rm -f $initdir/rc.iscsi fidone## Remove the iscsi daemon#for dir in $BINDIRSdo if [ -f $dir/iscsid ] ; then rm -f $dir/iscsid fidone## Remove the iscsi LUN activator#for dir in $BINDIRSdo if [ -f $dir/iscsilun ] ; then rm -f $dir/iscsilun fidone## Remove the iscsi-device utility#for dir in $BINDIRSdo if [ -f $dir/iscsi-device ] ; then rm -f $dir/iscsi-device fidone## Remove the iscsi-iname utility#for dir in $BINDIRSdo if [ -f $dir/iscsi-iname ] ; then rm -f $dir/iscsi-iname fidone## Remove the iscsi-ls utility#for dir in $BINDIRSdo if [ -f $dir/iscsi-ls ]; then rm -f $dir/iscsi-ls fidone# Remove the iscsi-id utility#for dir in $BINDIRSdo if [ -f $dir/iscsi-id ]; then rm -f $dir/iscsi-id fidone## Remove the iscsi-umountall utility#for dir in $BINDIRSdo if [ -f $dir/iscsi-umountall ] ; then rm -f $dir/iscsi-umountall fidone## Remove the iscsi-mountall utility#for dir in $BINDIRSdo if [ -f $dir/iscsi-mountall ] ; then rm -f $dir/iscsi-mountall fidone# Remove the man pagesfor dir in $MANDIRSdo if [ -f $dir/man8/iscsid.8 ] ; then rm -f $dir/man8/iscsid.8 fi if [ -f $dir/man5/iscsi.conf.5 ] ; then rm -f $dir/man5/iscsi.conf.5 fi if [ -f $dir/man1/iscsi-ls.1 ] ; then rm -f $dir/man1/iscsi-ls.1 fidone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -