mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-16 10:50:43 +03:00
gnomeos: start writing an install script
This commit is contained in:
parent
f1930d2c99
commit
1d93adc925
73
gnomeos/yocto/15_ostree
Executable file
73
gnomeos/yocto/15_ostree
Executable file
@ -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 <<EOF
|
||||
echo '"Loading ${os} ${version}"'
|
||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro init=/ostree/ostree-init ${args}
|
||||
EOF
|
||||
if test -n "${initrd}" ; then
|
||||
message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||
cat << EOF
|
||||
echo '$message'
|
||||
initrd ${rel_dirname}/${initrd}
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
machine=$(uname -m)
|
||||
kernels=$(echo /boot/vmlinuz-*.${machine})
|
||||
while [ "x${kernels}" != x ]; do
|
||||
linux=`version_find_latest $kernels` >&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
|
64
gnomeos/yocto/gnomeos-install.sh
Executable file
64
gnomeos/yocto/gnomeos-install.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
# -*- indent-tabs-mode: nil; -*-
|
||||
# Install OSTree to system
|
||||
#
|
||||
# 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_REPO_URL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ARCH=i686
|
||||
BRANCH_PREFIX="gnomeos-3.4-${ARCH}-"
|
||||
|
||||
if ! test -d /ostree; then
|
||||
mkdir /ostree
|
||||
|
||||
$SRCDIR/ostree-setup.sh /ostree
|
||||
fi
|
||||
|
||||
cd /ostree
|
||||
for branch in runtime devel; do
|
||||
rev=$(ostree --repo=$(pwd)/repo rev-parse ${BRANCH_PREFIX}${branch});
|
||||
if ! test -d ${BRANCH_PREFIX}${branch}-${rev}; then
|
||||
ostree --repo=repo checkout ${rev} ${BRANCH_PREFIX}${branch}-${rev}
|
||||
ostbuild chroot-run-triggers ${BRANCH_PREFIX}${branch}-${rev}
|
||||
fi
|
||||
rm -f ${BRANCH_PREFIX}${branch}-current
|
||||
ln -s ${BRANCH_PREFIX}${branch}-${rev} ${BRANCH_PREFIX}${branch}-current
|
||||
done
|
||||
rm -f current
|
||||
ln -s ${BRANCH_PREFIX}runtime-current current
|
||||
|
||||
cp -a ./${BRANCH_PREFIX}${branch}-current/usr/sbin/ostree-init .
|
||||
|
||||
cp $SRCDIR/15_ostree /etc/grub.d/
|
67
gnomeos/yocto/ostree-setup.sh
Executable file
67
gnomeos/yocto/ostree-setup.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
# -*- 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 -m 0755 ./var/{log,run,tmp,spool}
|
||||
mkdir -p ./var/lib/dbus
|
||||
dbus-uuidgen > ./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
|
Loading…
x
Reference in New Issue
Block a user