From 1d93adc925fa7b0b8c6fd3ecb794cedd82b9060a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 2 Feb 2012 07:46:52 -0500 Subject: [PATCH] gnomeos: start writing an install script --- gnomeos/yocto/15_ostree | 73 ++++++++++++++++++++++++++++++++ gnomeos/yocto/gnomeos-install.sh | 64 ++++++++++++++++++++++++++++ gnomeos/yocto/ostree-setup.sh | 67 +++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100755 gnomeos/yocto/15_ostree create mode 100755 gnomeos/yocto/gnomeos-install.sh create mode 100755 gnomeos/yocto/ostree-setup.sh diff --git a/gnomeos/yocto/15_ostree b/gnomeos/yocto/15_ostree new file mode 100755 index 00000000..d67cf444 --- /dev/null +++ b/gnomeos/yocto/15_ostree @@ -0,0 +1,73 @@ +#!/bin/sh + +set -e + +. /usr/lib/grub/grub-mkconfig_lib + +CLASS="--class gnu-linux --class gnu --class os" + +if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ + || uses_abstraction "${GRUB_DEVICE}" lvm; then + LINUX_ROOT_DEVICE=${GRUB_DEVICE} +else + LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} +fi + +ostree_linux_entry () +{ + os="$1" + version="$2" + args="$3" + + printf "menuentry '${os}; Linux ${version}' ${CLASS} {\n" + + cat << EOF + insmod gzio +EOF + + cat <&2 + basename=`basename $linux` + dirname=`dirname $linux` + rel_dirname=`make_system_path_relative_to_its_root $dirname` + version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` + alt_version=`echo $version | sed -e "s,\.old$,,g"` + linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + + initrd= + for i in "initrd.img-${version}" "initrd-${version}.img" \ + "initrd-${version}" "initramfs-${version}.img" \ + "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ + "initrd-${alt_version}" "initramfs-${alt_version}.img" \ + "initramfs-genkernel-${version}" \ + "initramfs-genkernel-${alt_version}"; do + if test -e "${dirname}/${i}" ; then + initrd="$i" + break + fi + done + + ostree_linux_entry "GNOMEOS 3.4" "${version}" \ + "${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_LINUX_DEFAULT}" + + kernels=`echo $kernels | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` +done diff --git a/gnomeos/yocto/gnomeos-install.sh b/gnomeos/yocto/gnomeos-install.sh new file mode 100755 index 00000000..8d906e3c --- /dev/null +++ b/gnomeos/yocto/gnomeos-install.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# -*- indent-tabs-mode: nil; -*- +# Install OSTree to system +# +# Copyright (C) 2011,2012 Colin Walters +# +# 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 < +# +# 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 < ./var/lib/dbus/machine-id + +mkdir ./var/lib/gdm +chown 2:2 ./var/lib/gdm + +touch ./var/shadow +chmod 0600 ./var/shadow + +mkdir repo +ostree --repo=repo init + +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