#!/bin/sh # # Create FHS directories below a target directory. # # Copyright (C) 2011 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. set -ex if [ "$#" != 1 ] then echo "Error: must give target root directory as argument." 1>&2 exit 1 fi target="$1" owner=root group=root perms=0755 dirs=" bin boot dev etc etc/network home lib media mnt opt proc root run sbin srv sys tmp usr usr/bin usr/include usr/lib usr/local usr/local/bin usr/local/lib usr/local/share usr/local/sbin usr/sbin usr/share usr/share/doc usr/share/info usr/share/man usr/share/man1 usr/share/man2 usr/share/man3 usr/share/man4 usr/share/man5 usr/share/man6 usr/share/man7 usr/share/man8 usr/share/misc var var/cache var/lib var/lock var/log var/run var/spool var/tmp " for dirname in $dirs do install -d -o "$owner" -g "$group" -m "$perms" "$target/$dirname" done while read link name; do ln -s "$link" "$target/$name" done <