remk_dir.sh

remk_dir.shremk_dir.sh#!/usr/bin/envbash#filename:remk_dir.sh#set-xSCRIPT_NAME=$(basename"$0")SCRIPT_DIR=$(cd"$(dirname"$0")&

大家好,欢迎来到IT知识分享网。remk_dir.sh"

remk_dir.sh

 

#!/usr/bin/env bash
#filename: remk_dir.sh

#set -x

SCRIPT_NAME=$(basename "$0")
SCRIPT_DIR=$(cd "$(dirname "$0")";pwd)
CUR_DIR=$(pwd)

remake_directory_defaults() {
    [ -d ${CUR_DIR}/dev ] || mkdir -p ${CUR_DIR}/dev
    [ -d ${CUR_DIR}/sys ] || mkdir -p ${CUR_DIR}/sys
    [ -d ${CUR_DIR}/proc ] || mkdir -p ${CUR_DIR}/proc
    [ -d ${CUR_DIR}/overlay ] || mkdir -p ${CUR_DIR}/overlay
    [ -d ${CUR_DIR}/mnt ] || mkdir -p ${CUR_DIR}/mnt
    [ -d ${CUR_DIR}/root ] || mkdir -p ${CUR_DIR}/root
    [ -d ${CUR_DIR}/home ] || mkdir -p ${CUR_DIR}/home

    [ -d ${CUR_DIR}/etc/crontabs ] || mkdir -p ${CUR_DIR}/etc/crontabs
    [ -d ${CUR_DIR}/etc/conntrackd ] || mkdir -p ${CUR_DIR}/etc/conntrackd
    [ -d ${CUR_DIR}/etc/luci-uploads ] || mkdir -p ${CUR_DIR}/etc/luci-uploads
    [ -d ${CUR_DIR}/etc/ssl/certs ] || mkdir -p ${CUR_DIR}/etc/ssl/certs
    [ -d ${CUR_DIR}/etc/ssl/private ] || mkdir -p ${CUR_DIR}/etc/ssl/private

    [ -d ${CUR_DIR}/lib/firmware ] || mkdir -p ${CUR_DIR}/lib/firmware

    [ -d ${CUR_DIR}/usr/lib/lua/posix ] || mkdir -p ${CUR_DIR}/usr/lib/lua/posix
    [ -d ${CUR_DIR}/usr/lib/opkg/lists ] || mkdir -p ${CUR_DIR}/usr/lib/opkg/lists
    [ -d ${CUR_DIR}/usr/local/natshell/nac/local_portal/cgi-bin ] || mkdir -p ${CUR_DIR}/usr/local/natshell/nac/local_portal/cgi-bin

    [ -d ${CUR_DIR}/tmp ] || mkdir -p ${CUR_DIR}/tmp
    [ -d ${CUR_DIR}/tmp ] && chmod 1777 ${CUR_DIR}/tmp
}

echo "remake directory defaults in ${CUR_DIR} ..."
[ -d ${CUR_DIR}/rom ] && remake_directory_defaults
echo "remake directory defaults in ${CUR_DIR} done."

exit 0

 

================ End

 

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/34585.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信