everestlinux-edge/tools/mkskel

62 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2023-02-17 08:46:32 -05:00
#!/bin/sh
# mkskel - create a filesystem layout
# (C) 2023 Everest Linux
# See the GNU GPL Version 3 for copyright details
ROOT_DIR=${2}
mkdirs() {
mkdir -pv ${ROOT_DIR}/{dev,home,mnt,proc,run,srv,sys,boot,etc,lost+found}
mkdir -pv ${ROOT_DIR}/{opt,root,var,tmp,include,share}
for DIR in bin lib sbin; do
mkdir -pv ${ROOT_DIR}/${DIR}
mkdir -pv ${ROOT_DIR}/usr/${DIR}
done
case $(uname -m) in
x86_64)
ln -sv ${ROOT_DIR}/lib ${ROOT_DIR}/lib64
ln -sv ${ROOT_DIR}/usr/lib ${ROOT_DIR}/usr/lib64
;;
esac
}
helpmsg() {
printf "usage: ${0} [-h] [-d] DIRECTORY\n"
}
helpmsg_big() {
printf "${0} - create a filesystem layout"
printf "usage: ${0} [-h] [-d] DIRECTORY\n"
printf "\n"
printf "${0} {-h} Show this message\n"
printf "${0} {-d DIRECTORY} Create a filesystem layout in DIRECTORY\n"
printf "\n"
printf "This program is free software.\n"
printf "See the GNU GPL version 3 for details.\n"
}
case $1 in
-h)
helpmsg_big "$@"
exit 0
;;
-d)
mkdirs "$@"
exit 0
;;
-*)
helpmsg "$@"
exit 1
;;
*)
helpmsg "$@"
exit 1
esac
helpmsg "$@"
exit 1