📄 rc.devfs
字号:
#! /bin/sh## /etc/rc.d/rc.devfs## Linux Boot Scripts by Richard Gooch <rgooch@atnf.csiro.au># Copyright 1993-1999 under GNU Copyleft version 2.0. See /etc/rc for# copyright notice.## Save and restore devfs ownerships and permissions## Written by Richard Gooch 11-JAN-1998## Updated by Richard Gooch 23-JAN-1998: Added "start" and "stop".## Updated by Richard Gooch 5-AUG-1998: Robustness improvements by# Roderich Schupp.## Updated by Richard Gooch 9-AUG-1998: Took account of change from# ".epoch" to ".devfsd".## Updated by Richard Gooch 19-AUG-1998: Test and tty pattern patch# by Roderich Schupp.## Updated by Richard Gooch 24-MAY-1999: Use sed instead of tr.## Last updated by Richard Gooch 25-MAY-1999: Don't save /dev/log.### Usage: rc.devfs save|restore [savedir] [devfsdir]## Note: "start" is a synonym for "restore" and "stop" is a synonym for "save".# Set VERBOSE to "no" if you would like a more quiet operation.VERBOSE=yes# Set TAROPTS to "v" or even "vv" to see which files get saved/restored.TAROPTS=option="$1"case "$option" in save|restore) ;; start) option=restore ;; stop) option=save ;; *) echo "No save or restore option given" ; exit 1 ;;esacif [ "$2" = "" ]; then savedir=/var/stateelse savedir=$2fiif [ ! -d $savedir ]; then echo "Directory: $savedir does not exist" exit 1fiif [ "$3" = "" ]; then if [ -d /devfs ]; then devfs=/devfs else devfs=/dev fielse devfs=$3figrep devfs /proc/filesystems >/dev/null || exit 0if [ ! -d $devfs ]; then echo "Directory: $devfs does not exist" exit 1elif [ ! -c $devfs/.devfsd ]; then echo "Directory: $devfs is not the root of a devfs filesystem" exit 1fisavefile=`echo $devfs | sed 's*/*_*g'`tarfile=${savedir}/devfssave.${savefile}.tar.gzcd $devfscase "$option" in save) [ "$VERBOSE" != no ] && echo "Saving $devfs permissions..." # You might want to adjust the pattern below to control # which file's permissions will be saved. # The sample pattern exludes all virtual consoles # as well as old and new style pseudo terminals. files=`find * -noleaf -cnewer .devfsd \ ! -regex 'tty[0-9]+\|vc/.*\|vcsa?[0-9]+\|vcc/.*\|[pt]ty[a-z][0-9a-f]\|pt[ms]/.*\|log' -print` rm -f $tarfile [ -n "$files" ] && tar cz${TAROPTS}f $tarfile $files ;; restore) [ "$VERBOSE" != no ] && echo "Restoring $devfs permissions..." [ -f $tarfile ] && tar xpz${TAROPTS}f $tarfile ;;esacexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -