⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.sh

📁 Serial 驱动程序
💻 SH
字号:
#!/bin/sh## This script is responsible for installing the Serial driver#if [ `whoami` != root ]; then	echo "You must be root to install the device driver!"	exit 1fi# Install a copy of the driver in the version independent locationif [ ! -d /lib/modules ]; then 	mkdir -p /lib/modulesfiif test -d /lib/modules/misc ; then    cp serial.o /lib/modules/misc    rm -f /lib/modules/serial.oelse    cp serial.o /lib/modulesfi# Install a copy of the driver in a kernel version specific locationif [ -f .kver ]; then    KVER=`sed -e 's/-SMP//' -e 's/-MOD//' .kver`    KVERSION=`cat .kver` else    echo "Missing .kver file!  Please rebuild the serial driver."    exit 1fiif grep -q smp_ /proc/ksyms ; then 	RSMP='-SMP'fiif grep -q "kfree" /proc/ksyms &&   ! grep -q "kfree$$" /proc/ksyms ; then	RMOD='-MOD'fiRVERSION=`uname -r`$RMOD$RSMPecho " "echo "Installing serial driver for Linux $KVERSION"echo " "if [ $KVERSION != $RVERSION ]; then    echo "WARNING: The current kernel is actually version $RVERSION."    echo " "fi## Actually install the kernel module#if [ ! -d /lib/modules/$KVER/misc ]; then 	mkdir -p /lib/modules/$KVER/miscficp serial.o /lib/modules/$KVER/misc## We're not playing the modules game any more, so remove the old # mod_serial.o file.# rm -f /lib/modules/mod_serial.o /lib/modules/$KVER/misc/mod_serial.o## Now that we're done, run depmod -a so that modprobe knows where to fund# stuff#depmod -a## Since the serial driver exports symbols, update the serial.ver and # modversions file.#if test -z "$LINUX_SRC" ; then    echo "Defaulting linux sources to /usr/src/linux"    LINUX_SRC=/usr/src/linuxfiVERFILE=$LINUX_SRC/include/linux/modules/serial.verMODVERFILE=$LINUX_SRC/include/linux/modversions.hif grep -q rh_kernel $MODVERFILE ; then    echo "RedHat kernel --- weird-shit modversions file not currently"    echo "supported.  This won't matter unless you want to compile PCMCIA "    echo "and want it to work with this driver (for modems, for example)."    echo " "else     if ! test -f $VERFILE || ! cmp -s serial.ver $VERFILE ; then 	echo "Updating $VERFILE"	cp serial.ver $VERFILE    fi    if ! grep -q /serial.ver $MODVERFILE ; then \	echo "Updating $MODVERFILE to include serial.ver"	sed -f modversions.sed < $MODVERFILE > ${MODVERFILE}.new	mv $MODVERFILE ${MODVERFILE}.old	mv ${MODVERFILE}.new $MODVERFILE    fifi## OK, now we install the installation script #if [ -d /etc/rc.d/init.d ]; then 	# This is a RedHat or other system using a System V init scheme	RC_DEST=/etc/rc.d/init.d/serial	RC_DIR=/etc/rc.d	RC_START=S83serial	RC_STOP=K18serialelif [ -d /etc/init.d ]; then 	# This is a Debian system	RC_DEST=/etc/init.d/serial	RC_DIR=/etc	RC_START=S83serial	RC_STOP=K20serialelse        # This must be a Slackware or other non-SysV init system	if [ ! -f /etc/rc.d/rc.serial ]; then		echo "The initialization script will be installed in "		echo "/etc/rc.d/rc.serial.  You will need to edit your "		echo "/etc/rc files to run /etc/rc.d/rc.serial"		if [ ! -d /etc/rc.d ]; then 			mkdir -p /etc/rc.d		fi	fi	RC_DEST=/etc/rc.d/rc.serial	RC_DIR=""fi		## Determine the version numbers of the installed script (if any) and the# rc.serial script which we have.#SRC_VERS=`grep "^# FILE_VERSION: " rc.serial | awk '{print $3}'`DEST_VERS=0if test -f $RC_DEST ; then    DEST_VERS=`grep "^# FILE_VERSION: " $RC_DEST | awk '{print $3}'`    if test -z "$DEST_VERS" ; then    	DEST_VERS=0    fifi## Only update the destination file if we have a newer version.#if test $SRC_VERS -gt $DEST_VERS ; then	if test -f $RC_DEST ; then		echo "Updating $RC_DEST"		NEW_INSTALL=no	else		echo "Installing $RC_DEST"		NEW_INSTALL=yes	fi	cp rc.serial $RC_DESTfiif test -n "$RC_DIR" ; then	rm -f $RC_DIR/rc?.d/[SK]??rc.serial	if test "$NEW_INSTALL" = "yes" ; then	        echo " "		echo "You are using a system which uses the System V init"		echo "scheme.  The initialization script has been installed"		echo "in $RC_DEST and it has been automatically "		echo "set up to be run when you reboot"		ln -sf ../init.d/serial $RC_DIR/rc2.d/${RC_START}		ln -sf ../init.d/serial $RC_DIR/rc3.d/${RC_START}		ln -sf ../init.d/serial $RC_DIR/rc5.d/${RC_START}		ln -sf ../init.d/serial $RC_DIR/rc0.d/${RC_STOP}		ln -sf ../init.d/serial $RC_DIR/rc1.d/${RC_STOP}		ln -sf ../init.d/serial $RC_DIR/rc6.d/${RC_STOP}	fi	if [ -f /etc/rc.d/rc.serial ]; then		echo "You have an old /etc/rc.d/rc.serial script"		echo "After checking to make sure it is no longer being used"		echo "you should delete it."	fifi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -