ostree/gnomeos/gnomeos-setup.sh
Diego Escalante Urrelo 7442009086 gnomeos-install: use /bin/bash, not /bin/sh
This scripts use bashisms, so use /bin/bash as the interpreter until
they are un-bashified.
2012-04-05 09:05:22 -04:00

80 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# -*- indent-tabs-mode: nil; -*-
# Set up ostree directory
#
# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -e
set -x
SRCDIR=`dirname $0`
WORKDIR=`pwd`
if test $(id -u) != 0; then
cat <<EOF
This script should be run as root.
EOF
exit 1
fi
usage () {
echo "$0 OSTREE_DIR_PATH"
exit 1
}
OSTREE_DIR_PATH=$1
shift
test -n "$OSTREE_DIR_PATH" || usage
cd "$OSTREE_DIR_PATH"
mkdir -p modules
mkdir -p -m 0755 ./var/{log,run,tmp,spool}
mkdir -p ./var/lib/dbus
dbus-uuidgen > ./var/lib/dbus/machine-id
mkdir -p ./var/tmp
chmod 1777 ./var/tmp
if ! test -L run; then
ln -s ../run run
fi
mkdir -p ./var/lib/gdm
chown 2:2 ./var/lib/gdm
touch ./var/shadow
chmod 0600 ./var/shadow
cat >./var/passwd << EOF
root::0:0:root:/:/bin/sh
dbus:*:1:1:dbus:/:/bin/false
gdm:*:2:2:gdm:/var/lib/gdm:/bin/false
EOF
cat >./var/group << EOF
root:*:0:root
dbus:*:1:
gdm:*:2:
EOF
if ! test -d repo; then
mkdir repo
ostree --repo=repo init
fi