mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-26 01:37:04 +00:00
Merge pull request #8 from opencomputeproject/master
merge from upstream
This commit is contained in:
72
Makefile
72
Makefile
@@ -12,68 +12,40 @@ endif
|
||||
|
||||
include $(ONL)/make/config.mk
|
||||
|
||||
all: amd64 ppc arm
|
||||
$(MAKE) -C REPO build-clean
|
||||
# All available architectures.
|
||||
ALL_ARCHES := amd64 powerpc armel arm64
|
||||
|
||||
onl-amd64 onl-x86 x86 x86_64 amd64: packages_base_all
|
||||
$(MAKE) -C packages/base/amd64/kernels
|
||||
$(MAKE) -C packages/base/amd64/initrds
|
||||
$(MAKE) -C packages/base/amd64/onlp
|
||||
$(MAKE) -C packages/base/amd64/onlp-snmpd
|
||||
$(MAKE) -C packages/base/amd64/faultd
|
||||
$(MAKE) -C builds/amd64/rootfs
|
||||
$(MAKE) -C builds/amd64/swi
|
||||
$(MAKE) -C builds/amd64/installer
|
||||
|
||||
onl-ppc ppc: packages_base_all
|
||||
$(MAKE) -C packages/base/powerpc/kernels
|
||||
$(MAKE) -C packages/base/powerpc/initrds
|
||||
$(MAKE) -C packages/base/powerpc/onlp
|
||||
$(MAKE) -C packages/base/powerpc/onlp-snmpd
|
||||
$(MAKE) -C packages/base/powerpc/faultd
|
||||
$(MAKE) -C packages/base/powerpc/fit
|
||||
$(MAKE) -C builds/powerpc/rootfs
|
||||
$(MAKE) -C builds/powerpc/swi
|
||||
$(MAKE) -C builds/powerpc/installer
|
||||
# Build rule for each architecture.
|
||||
define build_arch_template
|
||||
$(1) :
|
||||
$(MAKE) -C builds/$(1)
|
||||
endef
|
||||
$(foreach a,$(ALL_ARCHES),$(eval $(call build_arch_template,$(a))))
|
||||
|
||||
|
||||
ifdef ONL_DEBIAN_SUITE_jessie
|
||||
# Available build architectures based on the current suite
|
||||
BUILD_ARCHES_wheezy := amd64 powerpc
|
||||
BUILD_ARCHES_jessie := $(ALL_ARCHES)
|
||||
|
||||
arm_toolchain_check:
|
||||
@which arm-linux-gnueabi-gcc || (/bin/echo -e "*\n* ERROR\n*\n* This container does not support building for the ARM architecture.\n* Please use opennetworklinux/onlbuilder8:1.2 later.\n*" && exit 1)
|
||||
|
||||
onl-arm arm: arm_toolchain_check packages_base_all
|
||||
$(MAKE) -C packages/base/armel/kernels
|
||||
$(MAKE) -C packages/base/armel/initrds
|
||||
$(MAKE) -C packages/base/armel/onlp
|
||||
$(MAKE) -C packages/base/armel/onlp-snmpd
|
||||
$(MAKE) -C packages/base/armel/faultd
|
||||
$(MAKE) -C packages/base/armel/fit
|
||||
$(MAKE) -C builds/armel/rootfs
|
||||
$(MAKE) -C builds/armel/swi
|
||||
$(MAKE) -C builds/armel/installer
|
||||
else
|
||||
|
||||
onl-arm arm:
|
||||
@/bin/echo -e "*\n* Warning\n*\n* ARM Architecture support is only available in Jessie builds. Please use onbuilder -8.\n*"
|
||||
|
||||
endif
|
||||
# Build available architectures by default.
|
||||
.DEFAULT_GOAL := all
|
||||
all: $(BUILD_ARCHES_$(ONL_DEBIAN_SUITE))
|
||||
|
||||
|
||||
packages_base_all:
|
||||
$(MAKE) -C packages/base/all
|
||||
|
||||
rpc rebuild:
|
||||
rebuild:
|
||||
$(ONLPM) --rebuild-pkg-cache
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
modclean:
|
||||
rm -rf $(ONL)/make/modules/modules.*
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: docker
|
||||
|
||||
ifndef VERSION
|
||||
VERSION:=7
|
||||
VERSION := 8
|
||||
endif
|
||||
|
||||
docker_check:
|
||||
@@ -88,7 +60,7 @@ docker-debug: docker_check
|
||||
|
||||
|
||||
versions:
|
||||
$(ONL)/tools/make-versions.py --import-file=$(ONL)/tools/onlvi --class-name=OnlVersionImplementation --output-dir $(ONL)/make --force
|
||||
$(ONL)/tools/make-versions.py --import-file=$(ONL)/tools/onlvi --class-name=OnlVersionImplementation --output-dir $(ONL)/make/versions --force
|
||||
|
||||
relclean:
|
||||
@find $(ONL)/RELEASE -name "ONL-*" -delete
|
||||
|
||||
1
REPO/jessie/packages/binary-arm64/Makefile
Normal file
1
REPO/jessie/packages/binary-arm64/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/repo.mk
|
||||
@@ -1 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
include $(ONL)/make/arch-build.mk
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=amd64
|
||||
2
builds/amd64/installer/installed/PKG.yml
Normal file
2
builds/amd64/installer/installed/PKG.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=amd64 BOOTMODE=installed
|
||||
|
||||
3
builds/amd64/installer/installed/builds/Makefile
Normal file
3
builds/amd64/installer/installed/builds/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
BOOTMODE=INSTALLED
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
include $(ONL)/builds/any/installer/grub/builds/Makefile
|
||||
3
builds/amd64/installer/installed/builds/boot-config
Normal file
3
builds/amd64/installer/installed/builds/boot-config
Normal file
@@ -0,0 +1,3 @@
|
||||
NETDEV=ma1
|
||||
BOOTMODE=INSTALLED
|
||||
SWI=images::latest
|
||||
2
builds/amd64/installer/installed/builds/config/README
Normal file
2
builds/amd64/installer/installed/builds/config/README
Normal file
@@ -0,0 +1,2 @@
|
||||
This partition contains system configuration data that is persistant across installations and upgrades of ONL-based systems.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=amd64
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
*INSTALLER
|
||||
kernel-*
|
||||
initrd-*
|
||||
lib/
|
||||
usr/
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.9.6-x86-64-all:amd64 kernel-3.9.6-x86-64-all) \
|
||||
$(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all) \
|
||||
$(shell $(ONLPM) --find-file onl-kernel-3.18-x86-64-all:amd64 kernel-3.18-x86_64-all)
|
||||
|
||||
INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 onl-loader-initrd-amd64.cpio.gz)
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:amd64)
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad --fixup-perms autoperms.sh
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_LEGACY_INSTALLER
|
||||
|
||||
|
||||
|
||||
__installer:
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(foreach k,$(KERNELS),cp $(k) .;)
|
||||
$(ONL_V_at)cp $(INITRD) initrd-amd64
|
||||
$(foreach p,$(PLATFORMS), $(ONLPM) --extract-dir onl-platform-config-$(p):amd64 .;)
|
||||
# Fixme
|
||||
$(ONLPM) --extract-dir onl-swi:amd64 .
|
||||
mv ./usr/share/onl/packages/amd64/onl-swi/*.swi .
|
||||
rm -rf ./usr
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at) cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in amd64-installer.sh $(notdir $(KERNELS)) initrd-amd64 lib *.swi version-onl.sh boot-config
|
||||
$(ONL_V_at)rm -rf ./lib ./usr kernel-* initrd-amd64 $(ZTN_MANIFEST) *.swi version-onl.sh autoperms.sh
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
|
||||
shar installer: installer
|
||||
|
||||
clean:
|
||||
rm -f *.swi *.installer $(notdir $(KERNELS)) initrd-amd64
|
||||
@@ -1,437 +0,0 @@
|
||||
#!/bin/sh
|
||||
############################################################
|
||||
# <bsn.cl fy=2013 v=none>
|
||||
#
|
||||
# Copyright 2013, 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
#
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
# Open Network Linux Installation Script for AMD64.
|
||||
#
|
||||
# The purpose of this script is to automatically install Open Network Linux
|
||||
# on the target system.
|
||||
#
|
||||
# This script is ONIE-compatible.
|
||||
#
|
||||
# This script is can be run under a manual boot of the Open Network Linux
|
||||
# Loader as the execution environment for platforms that do not
|
||||
# support ONIE.
|
||||
#
|
||||
############################################################
|
||||
|
||||
IARCH="x86_64"
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" != "$IARCH" ]; then
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
echo "Installer Architecture: $IARCH"
|
||||
echo "Target Architecture: $ARCH"
|
||||
echo
|
||||
echo "This installer cannot be used on this"
|
||||
echo "target."
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
sleep 5
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# Installation utility functions
|
||||
#
|
||||
############################################################
|
||||
|
||||
CR="
|
||||
"
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
DEV=
|
||||
START_MB=
|
||||
|
||||
visit_parted()
|
||||
{
|
||||
local dev diskfn partfn rest
|
||||
dev=$1; shift
|
||||
diskfn=$1; shift
|
||||
partfn=$1; shift
|
||||
rest="$@"
|
||||
|
||||
local ifs ifs2 dummy
|
||||
ifs=$IFS; IFS=$CR
|
||||
for line in `parted -m $dev unit mb print`; do
|
||||
IFS=$ifs
|
||||
|
||||
line=`echo "$line" | sed -e 's/[;]$//'`
|
||||
|
||||
case "$line" in
|
||||
/dev/*)
|
||||
ifs2=$IFS; IFS=:
|
||||
set dummy $line
|
||||
IFS=$ifs2
|
||||
|
||||
local dev sz model lbsz pbsz typ modelname flags
|
||||
shift
|
||||
dev=$1; shift
|
||||
sz=$1; shift
|
||||
model=$1; shift
|
||||
lbsz=$1; shift
|
||||
pbsz=$1; shift
|
||||
typ=$1; shift
|
||||
modelname=$1; shift
|
||||
flags=$1; shift
|
||||
|
||||
eval $diskfn "$dev" "$sz" "$model" "$typ" "$flags" $rest || return 1
|
||||
|
||||
;;
|
||||
[0-9]:*)
|
||||
ifs2=$IFS; IFS=:
|
||||
set dummy $line
|
||||
IFS=$ifs2
|
||||
|
||||
local part start end sz fs label flags
|
||||
shift
|
||||
part=$1; shift
|
||||
start=$1; shift
|
||||
end=$1; shift
|
||||
sz=$1; shift
|
||||
fs=$1; shift
|
||||
label=$1; shift
|
||||
flags=$label
|
||||
|
||||
eval $partfn "$part" "$start" "$end" "$sz" "$fs" "$label" "$flags" $rest || return 1
|
||||
|
||||
;;
|
||||
|
||||
*) continue ;;
|
||||
esac
|
||||
|
||||
done
|
||||
IFS=$ifs
|
||||
}
|
||||
|
||||
do_handle_disk()
|
||||
{
|
||||
local dev sz model typ flags
|
||||
dev=$1; shift
|
||||
sz=$1; shift
|
||||
model=$1; shift
|
||||
typ=$1; shift
|
||||
flags=$1; shift
|
||||
|
||||
if test "$typ" != "gpt"; then
|
||||
installer_say "*** invalid partition table: $typ"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
ONL_CONFIG_TARBALL=/tmp/onl_config.tgz
|
||||
ONL_CONFIG_MOUNTPOINT=/mnt/onl_config_partition
|
||||
|
||||
do_handle_partitions()
|
||||
{
|
||||
local part start end sz fs label flags
|
||||
part=$1; shift
|
||||
start=$1; shift
|
||||
end=$1; shift
|
||||
sz=$1; shift
|
||||
fs=$1; shift
|
||||
label=$1; shift
|
||||
flags=$1; shift
|
||||
|
||||
installer_say "Examining $DEV part $part"
|
||||
|
||||
case "$label" in
|
||||
ONL-CONFIG)
|
||||
installer_say "Preserving the contents of the existing ONL-CONFIG partition..."
|
||||
rm -rf $ONL_CONFIG_MOUNTPOINT
|
||||
mkdir -p $ONL_CONFIG_MOUNTPOINT
|
||||
mount $DEV$part $ONL_CONFIG_MOUNTPOINT
|
||||
tar -C $ONL_CONFIG_MOUNTPOINT -cvzf $ONL_CONFIG_TARBALL .
|
||||
umount $ONL_CONFIG_MOUNTPOINT
|
||||
parted $DEV rm $part || return 1
|
||||
;;
|
||||
ONIE-BOOT|GRUB-BOOT|*-DIAG)
|
||||
installer_say "Partition $DEV$part: $label: Preserving..."
|
||||
;;
|
||||
*)
|
||||
installer_say "Partition $DEV$part: $label: Deleting..."
|
||||
parted $DEV rm $part || return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
get_free_space()
|
||||
{
|
||||
local free start
|
||||
free=`parted -s $DEV unit mb p free | grep Free | tail -1`
|
||||
echo $free | awk '{print $1}' | tr "MB" " "
|
||||
}
|
||||
|
||||
get_part_number()
|
||||
{
|
||||
local dev name part
|
||||
dev=$1; shift
|
||||
name=$1; shift
|
||||
part=$(parted -s $DEV unit mb p all | grep $name | awk {'print $1'})
|
||||
if [ -z "$part" ]; then
|
||||
installer_say "Failed to discover the partition number for $name"
|
||||
return 1
|
||||
else
|
||||
echo $part
|
||||
return 0
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
partition_gpt()
|
||||
{
|
||||
local start end part
|
||||
|
||||
start=$1; shift
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Boot Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating 128MB for ONL Boot partition..."
|
||||
end=$(( $start + 128 ))
|
||||
|
||||
parted -s $DEV unit mb mkpart "ONL-BOOT" ext4 ${start} ${end} || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-BOOT"); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
parted -s $DEV set $part boot on || return 1
|
||||
mkfs.ext4 -L "ONL-BOOT" ${DEV}${part}
|
||||
start=$(( $end + 1 ))
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Configuration Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating 128MB ONL Configuration partition..."
|
||||
end=$(( $start + 128 ))
|
||||
parted -s $DEV unit mb mkpart "ONL-CONFIG" ext4 ${start} ${end} || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-CONFIG"); then
|
||||
return 1
|
||||
fi
|
||||
mkfs.ext4 -L "ONL-CONFIG" ${DEV}${part}
|
||||
start=$(( $end + 1 ))
|
||||
|
||||
if [ -f $ONL_CONFIG_TARBALL ]; then
|
||||
installer_say "Restoring the contents of the ONL-CONFIG partition..."
|
||||
rm -rf $ONL_CONFIG_MOUNTPOINT
|
||||
mkdir -p $ONL_CONFIG_MOUNTPOINT
|
||||
mount $DEV$part $ONL_CONFIG_MOUNTPOINT
|
||||
tar -C $ONL_CONFIG_MOUNTPOINT -xvzf $ONL_CONFIG_TARBALL
|
||||
umount $ONL_CONFIG_MOUNTPOINT
|
||||
fi
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Image Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating 1G ONL Image partition..."
|
||||
end=$(( $start + 1024 ))
|
||||
|
||||
parted -s $DEV unit mb mkpart "ONL-IMAGES" ext4 ${start} ${end} || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-IMAGES"); then
|
||||
return 1
|
||||
fi
|
||||
mkfs.ext4 -L "ONL-IMAGES" ${DEV}${part}
|
||||
start=$(( $end + 1 ))
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Root Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating the ONL Data partition..."
|
||||
parted -s $DEV unit mb mkpart "ONL-DATA" ext4 ${start} "100%" || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-DATA"); then
|
||||
return 1
|
||||
fi
|
||||
mkfs.ext4 -L "ONL-DATA" ${DEV}${part}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
installer_standard_gpt_install()
|
||||
{
|
||||
DEV=$1; shift
|
||||
|
||||
if [ -z $DEV ]; then
|
||||
# Install NOS to the same block device as ONIE image
|
||||
DEV=$(blkid | grep ONIE-BOOT | awk '{print $1}' | sed -e 's/[1-9][0-9]*:.*$//' | sed -e 's/\([0-9]\)\(p\)/\1/' | head -n 1)
|
||||
[ -b "$DEV" ] || {
|
||||
echo "Error: Unable to determine the block device to install NOS"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
visit_parted $DEV do_handle_disk do_handle_partitions || return 1
|
||||
partition_gpt $(get_free_space) || return 1
|
||||
|
||||
installer_say "Installing boot files..."
|
||||
mkdir "$workdir/mnt"
|
||||
|
||||
if [ -f "${installer_dir}/boot-config" ]; then
|
||||
installer_say "Installing boot-config..."
|
||||
mount LABEL="ONL-BOOT" "$workdir/mnt"
|
||||
cp "${installer_dir}/boot-config" "$workdir/mnt/boot-config"
|
||||
umount "$workdir/mnt"
|
||||
fi
|
||||
|
||||
SWISRC=`ls ${installer_dir}/*.swi`
|
||||
|
||||
if test -f "${SWISRC}"; then
|
||||
if test ! "${SWIDST}"; then
|
||||
SWIDST="$(basename ${SWISRC})"
|
||||
fi
|
||||
installer_say "Installing Open Network Linux Software Image (${SWIDST})..."
|
||||
mount LABEL="ONL-IMAGES" "$workdir/mnt"
|
||||
cp "${SWISRC}" "$workdir/mnt/${SWIDST}"
|
||||
umount "$workdir/mnt"
|
||||
fi
|
||||
|
||||
installer_say "Installing kernels"
|
||||
mount LABEL=ONL-BOOT -t ext4 "$workdir/mnt"
|
||||
echo ${installer_dir}
|
||||
cp ${installer_dir}/kernel-* "$workdir/mnt/"
|
||||
cp "${installer_dir}/initrd-amd64" "$workdir/mnt/."
|
||||
mkdir "$workdir/mnt/grub"
|
||||
cp "${installer_platform_dir}/onl/boot/grub.cfg" "$workdir/mnt/grub/grub.cfg"
|
||||
|
||||
installer_say "Installing GRUB"
|
||||
grub-install --boot-directory="$workdir/mnt" $DEV
|
||||
|
||||
# leave the GRUB directory mounted,
|
||||
# so we can manipulate the GRUB environment
|
||||
BOOTDIR="$workdir/mnt"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
|
||||
installer_script=${0##*/}
|
||||
installer_zip=$1
|
||||
|
||||
BOOTDIR=/mnt/onie-boot
|
||||
# initial boot partition (onie)
|
||||
|
||||
# Pickup ONIE defines for this machine.
|
||||
if test -r /etc/machine.conf; then . /etc/machine.conf; fi
|
||||
|
||||
#
|
||||
# Installation environment setup.
|
||||
#
|
||||
if test "${onie_platform}"; then
|
||||
:
|
||||
else
|
||||
echo "Missing onie_platform (invalid /etc/machine.conf)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Running under ONIE, most likely in the background in installer mode.
|
||||
# Our messages have to be sent to the console directly, not to stdout.
|
||||
installer_say()
|
||||
{
|
||||
echo "$@" > /dev/console
|
||||
}
|
||||
|
||||
workdir=$(mktemp -d -t install-XXXXXX)
|
||||
|
||||
# Installation failure message.
|
||||
do_cleanup()
|
||||
{
|
||||
installer_say "Install failed."
|
||||
cat /var/log/onie.log > /dev/console
|
||||
installer_say "Install failed. See log messages above for details"
|
||||
|
||||
grep "$workdir" /proc/mounts | cut -d' ' -f2 | sort -r | xargs -r -n 1 umount
|
||||
cd /tmp
|
||||
rm -fr "$workdir"
|
||||
|
||||
sleep 3
|
||||
#reboot
|
||||
}
|
||||
|
||||
trap "do_cleanup" 0 1
|
||||
|
||||
if test -z "${installer_platform}"; then
|
||||
# Our platform identifiers are equal to the ONIE platform identifiers without underscores:
|
||||
installer_platform=`echo ${onie_platform} | tr "_" "-"`
|
||||
installer_arch=${onie_arch}
|
||||
fi
|
||||
installer_say "Open Network Linux installer running under ONIE."
|
||||
|
||||
#
|
||||
# Remount tmpfs larger if possible.
|
||||
# We will be doing all of our work out of /tmp
|
||||
#
|
||||
mount -o remount,size=1024M /tmp || true
|
||||
|
||||
# Unpack our distribution
|
||||
installer_say "Unpacking Open Network Linux installer files..."
|
||||
installer_dir=`pwd`
|
||||
if test "$SFX_PAD"; then
|
||||
# ha ha, busybox cannot exclude multiple files
|
||||
unzip $installer_zip -x $SFX_PAD
|
||||
elif test "$SFX_UNZIP"; then
|
||||
unzip $installer_zip -x $installer_script
|
||||
else
|
||||
dd if=$installer_zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \
|
||||
| unzip - -x $installer_script
|
||||
fi
|
||||
|
||||
if [ -f "${installer_dir}/versions.sh" ]; then
|
||||
. "${installer_dir}/versions.sh"
|
||||
installer_say "${VERSION_STRING} Installer"
|
||||
fi
|
||||
|
||||
installer_say "Detected platform: ${installer_platform}"
|
||||
|
||||
# Look for the platform installer directory.
|
||||
installer_platform_dir="${installer_dir}/lib/platform-config/${installer_platform}"
|
||||
if test -d "${installer_platform_dir}"; then
|
||||
# Source the installer scriptlet
|
||||
. "${installer_platform_dir}/onl/install/${installer_platform}.sh"
|
||||
else
|
||||
installer_say "This installer does not support the ${installer_platform} platform."
|
||||
installer_say "Available platforms are:"
|
||||
list=`ls "${installer_dir}/lib/platform-config"`
|
||||
installer_say "${list}"
|
||||
installer_say "Installation cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The platform script must provide this function. This performs the actual install for the platform.
|
||||
platform_installer
|
||||
|
||||
trap - 0 1
|
||||
installer_say "Install finished. Rebooting to Open Network Linux."
|
||||
sleep 3
|
||||
#reboot
|
||||
|
||||
exit
|
||||
|
||||
# Do not add any additional whitespace after this point.
|
||||
PAYLOAD_FOLLOWS
|
||||
1
builds/amd64/installer/swi/PKG.yml
Normal file
1
builds/amd64/installer/swi/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=amd64 BOOTMODE=swi
|
||||
@@ -1,2 +1,3 @@
|
||||
BOOTMODE=SWI
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
include $(ONL)/builds/any/installer/grub/builds/Makefile
|
||||
@@ -1,4 +1,3 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
2
builds/amd64/installer/swi/builds/config/README
Normal file
2
builds/amd64/installer/swi/builds/config/README
Normal file
@@ -0,0 +1,2 @@
|
||||
This partition contains system configuration data that is persistant across installations and upgrades of ONL-based systems.
|
||||
|
||||
@@ -7,12 +7,13 @@ prerequisites:
|
||||
|
||||
common:
|
||||
arch: $ARCH
|
||||
version: $FNAME_RELEASE_ID
|
||||
version: 0.$FNAME_RELEASE_ID
|
||||
copyright: Copyright 2016 Big Switch Networks
|
||||
maintainer: support@bigswitch.com
|
||||
support: opennetworklinux@googlegroups.com
|
||||
|
||||
packages:
|
||||
- name: onl-installer
|
||||
- name: onl-installer-$BOOTMODE
|
||||
summary: Open Network Linux $ARCH Installer
|
||||
|
||||
files:
|
||||
|
||||
@@ -2,92 +2,28 @@ ifndef ARCH
|
||||
$(error $$ARCH not set)
|
||||
endif
|
||||
|
||||
ONLPLATFORM = python $(ONL)/tools/onlplatform.py
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:$(ARCH))
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad --fixup-perms autoperms.sh
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
ifndef BOOTMODE
|
||||
$(error $$BOOTMODE not set)
|
||||
endif
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_INSTALLER
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_$(BOOTMODE)_INSTALLER
|
||||
|
||||
ifeq ($(ARCH), amd64)
|
||||
INSTALLER_ARCH = x86_64
|
||||
else
|
||||
INSTALLER_ARCH = $(ARCH)
|
||||
endif
|
||||
MKINSTALLER_OPTS = \
|
||||
--arch $(ARCH) \
|
||||
--boot-config boot-config \
|
||||
--add-dir config \
|
||||
--initrd onl-loader-initrd:$(ARCH) onl-loader-initrd-$(ARCH).cpio.gz \
|
||||
--swi onl-swi:$(ARCH) \
|
||||
--preinstall-script $(ONL)/builds/any/installer/sample-preinstall.sh \
|
||||
--postinstall-script $(ONL)/builds/any/installer/sample-postinstall.sh \
|
||||
--plugin $(ONL)/builds/any/installer/sample-preinstall.py \
|
||||
--plugin $(ONL)/builds/any/installer/sample-postinstall.py \
|
||||
# THIS LINE INTENTIONALLY LEFT BLANK
|
||||
|
||||
__installer: __installer_platform_files __installer_swi_files
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(ONL_V_at)cp /dev/null installer.sh
|
||||
$(ONL_V_at): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
set dummy *.cpio.gz; initrd="$$2" ;\
|
||||
sed \
|
||||
-e 's^@ONLVERSION@^$(VERSION_STRING)^g' \
|
||||
-e "s^@INITRD_ARCHIVE@^$$initrd^g" \
|
||||
-e 's^@INITRD_OFFSET@^^g' \
|
||||
-e 's^@INITRD_SIZE@^^g' \
|
||||
-e 's^@ARCH@^$(INSTALLER_ARCH)^g' \
|
||||
$(ONL)/builds/any/installer/installer.sh.in \
|
||||
>> installer.sh
|
||||
$(ONL_V_at)echo "PAYLOAD_FOLLOWS" >> installer.sh
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in installer.sh kernel-* onl-loader-initrd-* *.swi version-onl.sh boot-config
|
||||
$(ONL_V_at)rm -rf installer.sh kernel-* onl-loader-initrd-* $(ZTN_MANIFEST) *.swi version-onl.sh autoperms.sh
|
||||
__installer:
|
||||
$(ONL)/tools/mkinstaller.py $(MKINSTALLER_OPTS) --out $(INSTALLER_NAME)
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
__installer_platform_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
l="$(PLATFORMS)"; for p in $$l; do \
|
||||
src=$$($(ONLPLATFORM) $$p $(ARCH) kernel 2>/dev/null) || : ;\
|
||||
if test "$$src"; then \
|
||||
dst=$${src##*/} ;\
|
||||
if test "$dst" -ot Makefile; then \
|
||||
: ;\
|
||||
else \
|
||||
echo "Staging $$dst for $$p" ;\
|
||||
cp "$$src" "$$dst" ;\
|
||||
fi ;\
|
||||
fi ;\
|
||||
src=$$($(ONLPLATFORM) $$p $(ARCH) initrd 2>/dev/null) || : ;\
|
||||
if test "$$src"; then \
|
||||
dst=$${src##*/} ;\
|
||||
if test "$dst" -ot Makefile; then \
|
||||
: ;\
|
||||
else \
|
||||
echo "Staging $$dst for $$p" ;\
|
||||
cp "$$src" "$$dst" ;\
|
||||
fi ;\
|
||||
fi ;\
|
||||
done ;\
|
||||
:
|
||||
|
||||
ifndef NO_SWI
|
||||
__installer_swi_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
swidir=$$(mktemp -d $(PWD)/swi-d-XXXXXX) ;\
|
||||
$(ONLPM) --extract-dir onl-swi:$(ARCH) $$swidir ;\
|
||||
mv $$swidir/usr/share/onl/packages/$(ARCH)/onl-swi/*.swi . ;\
|
||||
rm -fr $$swidir ;\
|
||||
:
|
||||
else
|
||||
__installer_swi_files:
|
||||
$(ONL_V_GEN):
|
||||
endif
|
||||
|
||||
shar installer: installer
|
||||
|
||||
clean:
|
||||
rm -f *.swi *.installer $(notdir $(KERNELS)) *initrd*.cpio.gz
|
||||
|
||||
@@ -9,16 +9,7 @@
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
# SwitchLight Installation Script for PPC.
|
||||
#
|
||||
# The purpose of this script is to automatically install SwitchLight
|
||||
# on the target system.
|
||||
#
|
||||
# This script is ONIE-compatible.
|
||||
#
|
||||
# This script is can be run under a manual boot of the SwitchLight
|
||||
# Loader as the execution environment for platforms that do not
|
||||
# support ONIE.
|
||||
# Open Network Linux Installation Script
|
||||
#
|
||||
############################################################
|
||||
|
||||
@@ -28,6 +19,7 @@ if test "$ARCH" != "$IARCH"; then
|
||||
# identify mappings between kernel arch and debian arch
|
||||
case "$IARCH:$ARCH" in
|
||||
armel:armv7l) ;;
|
||||
arm64:aarch64) ;;
|
||||
powerpc:ppc) ;;
|
||||
*)
|
||||
echo
|
||||
@@ -51,7 +43,7 @@ case "$ARCH" in
|
||||
x86*|amd*|i?86*)
|
||||
ARCH_X86=$ARCH
|
||||
;;
|
||||
arm*)
|
||||
arm*|aarch64)
|
||||
ARCH_ARM=$ARCH
|
||||
;;
|
||||
*)
|
||||
@@ -160,7 +152,7 @@ visit_proc_mounts() {
|
||||
local ifs line dummy fn rest sts
|
||||
fn=$1; shift
|
||||
rest="$@"
|
||||
|
||||
|
||||
ifs=$IFS; IFS=$CR
|
||||
for line in $(cat /proc/mounts); do
|
||||
IFS=$ifs
|
||||
@@ -369,16 +361,44 @@ else
|
||||
installer_list=$initrd_archive
|
||||
fi
|
||||
|
||||
installer_unzip() {
|
||||
local zip tmp dummy
|
||||
zip=$1; shift
|
||||
|
||||
installer_say "Extracting from $zip: $@ ..."
|
||||
|
||||
tmp=$(mktemp -d -t "unzip-XXXXXX")
|
||||
if test "$SFX_PAD"; then
|
||||
# ha ha, busybox cannot exclude multiple files
|
||||
unzip -o $zip "$@" -x $SFX_PAD -d $tmp
|
||||
elif test "$SFX_UNZIP"; then
|
||||
unzip -o $zip "$@" -x $installer_script -d $tmp
|
||||
else
|
||||
dd if=$zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \
|
||||
| unzip -o - "$@" -x $installer_script -d $tmp
|
||||
fi
|
||||
|
||||
rm -f $tmp/$installer_script
|
||||
if test "$SFX_PAD"; then
|
||||
rm -f $tmp/$SFX_PAD
|
||||
fi
|
||||
|
||||
set dummy $tmp/*
|
||||
if test -e "$2"; then
|
||||
shift
|
||||
while test $# -gt 0; do
|
||||
mv "$1" .
|
||||
shift
|
||||
done
|
||||
else
|
||||
installer_say "Extracting from $zip: no files extracted"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
installer_say "Unpacking ONL installer files..."
|
||||
if test "$SFX_PAD"; then
|
||||
# ha ha, busybox cannot exclude multiple files
|
||||
unzip -o $installer_zip $installer_list -x $SFX_PAD
|
||||
elif test "$SFX_UNZIP"; then
|
||||
unzip -o $installer_zip $installer_list -x $installer_script
|
||||
else
|
||||
dd if=$installer_zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \
|
||||
| unzip -o - $installer_list -x $installer_script
|
||||
fi
|
||||
installer_unzip $installer_zip $installer_list
|
||||
|
||||
# Developer debugging
|
||||
if has_boot_env onl_installer_unpack_only; then installer_unpack_only=1; fi
|
||||
@@ -408,10 +428,43 @@ installer_mkchroot "${rootdir}"
|
||||
mkdir -p "${rootdir}/mnt/installer"
|
||||
mount -o ro,bind "${installer_dir}" "${rootdir}/mnt/installer"
|
||||
|
||||
# make the onie boot files available to the chroot
|
||||
mkdir -p "${rootdir}/mnt/onie-boot"
|
||||
if test -d "/mnt/onie-boot"; then
|
||||
mount -o ro,bind "/mnt/onie-boot" "${rootdir}/mnt/onie-boot"
|
||||
blkid_find_onie() {
|
||||
local dev label
|
||||
dev=$1; shift
|
||||
label=$1; shift
|
||||
rest="$@"
|
||||
|
||||
installer_say "Examining $dev --> $label"
|
||||
if test "$label" = "ONIE-BOOT"; then
|
||||
installer_say "Found ONIE-BOOT at $dev"
|
||||
ONIE_BOOT_DEVICE="$dev"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# not found, skip
|
||||
return 0
|
||||
}
|
||||
|
||||
# make sure onie-boot is mounted
|
||||
if test -d /mnt/onie-boot; then
|
||||
if grep -q " /mnt/onie-boot " /proc/mounts; then
|
||||
:
|
||||
else
|
||||
ONIE_BOOT_DEVICE=
|
||||
visit_blkid blkid_find_onie
|
||||
if test -b "$ONIE_BOOT_DEVICE"; then
|
||||
installer_say "Mounting ONIE-BOOT ($ONIE_BOOT_DEVICE) as /mnt/onie-boot"
|
||||
mount -o defaults,rw $ONIE_BOOT_DEVICE /mnt/onie-boot
|
||||
else
|
||||
installer_say "*** missing ONIE-BOOT device"
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -q " /mnt/onie-boot " /proc/mounts; then
|
||||
# make the onie boot files available to the chroot
|
||||
mkdir -p "${rootdir}/mnt/onie-boot"
|
||||
mount -o ro,bind "/mnt/onie-boot" "${rootdir}/mnt/onie-boot"
|
||||
fi
|
||||
fi
|
||||
|
||||
# generate config for installer environment
|
||||
@@ -488,6 +541,13 @@ else
|
||||
installer_say "*** watch out for lingering mount-points"
|
||||
fi
|
||||
|
||||
installer_unzip $installer_zip preinstall.sh || :
|
||||
if test -f preinstall.sh; then
|
||||
installer_say "Invoking pre-install actions"
|
||||
chmod +x preinstall.sh
|
||||
./preinstall.sh $rootdir
|
||||
fi
|
||||
|
||||
chroot "${rootdir}" $installer_shell
|
||||
|
||||
if test -f "$postinst"; then
|
||||
@@ -497,6 +557,12 @@ if test -f "$postinst"; then
|
||||
set +x
|
||||
fi
|
||||
|
||||
installer_unzip $installer_zip postinstall.sh || :
|
||||
if test -f preinstall.sh; then
|
||||
chmod +x postinstall.sh
|
||||
./postinstall.sh $rootdir
|
||||
fi
|
||||
|
||||
trap - 0 1
|
||||
installer_umount
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
prerequisites:
|
||||
broken: true
|
||||
packages: [ "onl-swi:$ARCH" ]
|
||||
|
||||
common:
|
||||
arch: $ARCH
|
||||
version: $FNAME_RELEASE_ID
|
||||
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
|
||||
maintainer: support@bigswitch.com
|
||||
|
||||
packages:
|
||||
- name: onl-legacy-installer
|
||||
summary: Open Network Linux $ARCH Legacy Installer
|
||||
|
||||
files:
|
||||
builds/*INSTALLER : $$PKG_INSTALL/
|
||||
builds/*.md5sum : $$PKG_INSTALL/
|
||||
|
||||
changelog: Change changes changes.,
|
||||
|
||||
|
||||
release:
|
||||
- builds/*INSTALLER : $ARCH/
|
||||
- builds/*.md5sum : $ARCH/
|
||||
@@ -1,43 +0,0 @@
|
||||
ifndef ARCH
|
||||
$(error $$ARCH not set)
|
||||
endif
|
||||
|
||||
THISDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_LEGACY_INSTALLER
|
||||
|
||||
FIT_IMAGE_ALL := $(shell $(ONLPM) --find-file onl-loader-fit:$(ARCH) onl-loader-fit.itb)
|
||||
|
||||
# Fixme -- should come from the FIT manifest, not the initrd manifest
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:$(ARCH))
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
__installer:
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(ONL_V_at)cp $(FIT_IMAGE_ALL) .
|
||||
$(foreach p,$(PLATFORMS), $(ONLPM) --extract-dir onl-platform-config-$(p):$(ARCH) .;)
|
||||
# Fixme
|
||||
ifndef NO_SWI
|
||||
$(ONLPM) --extract-dir onl-swi:$(ARCH) .
|
||||
mv ./usr/share/onl/packages/$(ARCH)/onl-swi/*.swi .
|
||||
endif
|
||||
rm -rf ./usr
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at) cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)sed s/@@IARCH@@/$(ARCH)/g $(THISDIR)/fit-installer.sh > fit-installer.sh
|
||||
$(ONL_V_at)sed s/@@IARCH@@/$(ARCH)/g $(THISDIR)/fit-install-lib > fit-install-lib
|
||||
$(ONL_V_at)cp $(THISDIR)/boot-config .
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in fit-installer.sh fit-install-lib *.itb lib *.swi version-onl.sh boot-config $(INSTALLER_EXTRA_FILES)
|
||||
$(ONL_V_at)rm -rf ./lib *.swi version-onl.sh autoperms.sh *.itb
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
|
||||
shar installer: __installer
|
||||
@@ -1,412 +0,0 @@
|
||||
# -*- sh -*-
|
||||
######################################################################
|
||||
#
|
||||
# lib.sh
|
||||
#
|
||||
# Common files for install/recovery
|
||||
#
|
||||
######################################################################
|
||||
|
||||
############################################################
|
||||
#
|
||||
# Installation Utility Functions
|
||||
#
|
||||
############################################################
|
||||
|
||||
case "`/usr/sbin/fw_setenv --help 2>&1`" in
|
||||
*"-f"*"Force update"*)
|
||||
fw_setenv_dash_f="-f"
|
||||
;;
|
||||
esac
|
||||
|
||||
fw_setenv_f_s() {
|
||||
local f
|
||||
f=$1; shift
|
||||
|
||||
/usr/sbin/fw_setenv ${fw_setenv_dash_f} -s "$f"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_create_device_file <blockdev> <partno>
|
||||
# <blockdev> The block device name
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Set the global variable 'installer_df' with the name of
|
||||
# the created device file.
|
||||
#
|
||||
# We can't always rely on the existance of a partition's
|
||||
# device file after the device has been formatted.
|
||||
#
|
||||
# This function creates the appropriate device file
|
||||
# for a given block partition to avoid this problem.
|
||||
#
|
||||
#
|
||||
|
||||
installer_create_device_file() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
# Determine the device major number for the given block device:
|
||||
local major=`ls -l /dev/${blockdev} | tr "," " " | awk '{print $5}'`
|
||||
|
||||
# Create a new device file matching the given partition
|
||||
installer_df=$(mktemp)
|
||||
rm ${installer_df}
|
||||
mknod "${installer_df}" b "${major}" "${partno}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_partition_cp <blockdev> <partno> <src> <dst>
|
||||
#
|
||||
# <blockdev> The block device name
|
||||
# <partno> The partition number
|
||||
# <src> The local source filename
|
||||
# <dst> The destination filename
|
||||
#
|
||||
# Copy the source file to the given partition.
|
||||
# The partition must be formatted/mountable.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_partition_cp() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
local src=$3
|
||||
local dst=$4
|
||||
|
||||
installer_create_device_file ${blockdev} ${partno}
|
||||
mkdir -p "${installer_df}.mount"
|
||||
mount "${installer_df}" "${installer_df}.mount"
|
||||
cp "${src}" "${installer_df}.mount/${dst}"
|
||||
umount "${installer_df}.mount"
|
||||
rm "${installer_df}"
|
||||
rmdir "${installer_df}.mount"
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_partition_dd <blockdev> <partno> <src>
|
||||
#
|
||||
# <blockdev> The block device name
|
||||
# <partno> The partition number.
|
||||
# <src> The source file.
|
||||
#
|
||||
# 'dd' the contents of the src file directly to the given partition.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_partition_dd() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
local src=$3
|
||||
|
||||
# installer_partition_dd <blockdev> <partno> <src>
|
||||
installer_create_device_file ${blockdev} ${partno}
|
||||
dd if=${src} of="${installer_df}" bs=1024
|
||||
rm "${installer_df}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_partition_format <blockdev> <partno> <mkfs>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
# <mkfs> The formatting tool.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_partition_format() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
local mkfs=$3
|
||||
local options=$4
|
||||
local partition="$1$2"
|
||||
|
||||
installer_say "Format ${partition}..."
|
||||
installer_create_device_file ${blockdev} ${partno}
|
||||
"${mkfs}" ${options} "${installer_df}"
|
||||
installer_say "Format ${partition} complete."
|
||||
rm "${installer_df}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_umount_blockdev <blockdev>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
#
|
||||
# Unmount all partitions of the given blockdevice.
|
||||
#
|
||||
# Required to avoid errors when repartitioning block
|
||||
# devices that are currently mounted.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_umount_blockdev() {
|
||||
local blockdev=$1
|
||||
local mounts=`cat /proc/mounts | grep ${blockdev} | awk '{print $2}'`
|
||||
if [ "$mounts" ]; then
|
||||
umount $mounts || :
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_blockdev_format <blockdev> <p1size> <p2size> <p3size>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <p1size> The size of the boot partition.
|
||||
# <p2size> The size of the config partition.
|
||||
# <p3size> The size of the image partition.
|
||||
# <p4size> [Optional] The size of the data partition.
|
||||
# If p4size is unset, the remainder of the device will be used
|
||||
# for the data partition.
|
||||
#
|
||||
############################################################
|
||||
ONL_CONFIG_TARBALL=/tmp/onl_config.tgz
|
||||
ONL_CONFIG_MOUNTPOINT=/mnt/onl_config_partition
|
||||
|
||||
installer_blockdev_format() {
|
||||
local blockdev=$1
|
||||
local partition1size=$2
|
||||
local partition2size=$3
|
||||
local partition3size=$4
|
||||
local partition4size=$5
|
||||
|
||||
if [ -n "$ONL_BOOT_SIZE" ]; then
|
||||
echo "Using ONL_BOOT_SIZE override ($ONL_BOOT_SIZE)"
|
||||
partition1size=$ONL_BOOT_SIZE
|
||||
fi
|
||||
|
||||
|
||||
|
||||
onl_config_partition=$(blkid | grep ONL-CONFIG | awk '{print $1}' | tr -d ':')
|
||||
|
||||
#
|
||||
# If an ONL-CONFIG partition exists, we need to save and restore its contents.
|
||||
#
|
||||
if [ -n "$onl_config_partition" ]; then
|
||||
installer_say "Preserving the contents of the existing ONL-CONFIG partition..."
|
||||
rm -rf $ONL_CONFIG_MOUNTPOINT
|
||||
mkdir -p $ONL_CONFIG_MOUNTPOINT
|
||||
echo mount "$onl_config_partition" $ONL_CONFIG_MOUNTPOINT
|
||||
mount "$onl_config_partition" $ONL_CONFIG_MOUNTPOINT
|
||||
tar -C $ONL_CONFIG_MOUNTPOINT -cvzf $ONL_CONFIG_TARBALL .
|
||||
umount $ONL_CONFIG_MOUNTPOINT
|
||||
fi
|
||||
|
||||
|
||||
|
||||
installer_umount_blockdev ${blockdev}
|
||||
installer_say "Formatting ${blockdev} as ${partition1size}:${partition2size}:${partition3size}:${partition4size}."
|
||||
echo -e "o\nn\np\n1\n\n+${partition1size}\nn\np\n2\n\n+${partition2size}\nn\np\n3\n\n+${partition3size}\nn\np\n4\n\n${partition4size}\np\nw\n" | fdisk /dev/${blockdev}
|
||||
|
||||
|
||||
_mkfs="mkfs.ext2"
|
||||
_archtools="${installer_dir}/`uname -m`"
|
||||
if [ -f "${_archtools}/mkfs.ext2" ]; then
|
||||
chmod a+x ${_archtools}/*
|
||||
echo "Using installer archtools mkfs.ext2..."
|
||||
_mkfs="${_archtools}/mkfs.ext2"
|
||||
ls -l "${_archtools}"
|
||||
fi
|
||||
|
||||
installer_partition_format ${blockdev} 1 $_mkfs "-L ONL-BOOT"
|
||||
installer_partition_format ${blockdev} 2 $_mkfs "-L ONL-CONFIG"
|
||||
installer_partition_format ${blockdev} 3 $_mkfs "-L ONL-IMAGES"
|
||||
installer_partition_format ${blockdev} 4 $_mkfs "-L ONL-DATA"
|
||||
|
||||
if [ -f $ONL_CONFIG_TARBALL ]; then
|
||||
installer_say "Restoring the contents of the existing ONL-CONFIG partition..."
|
||||
installer_create_device_file ${blockdev} 2
|
||||
mkdir -p "${installer_df}.mount"
|
||||
mount "${installer_df}" "${installer_df}.mount"
|
||||
tar -C "${installer_df}.mount" -xvzf $ONL_CONFIG_TARBALL
|
||||
umount "${installer_df}.mount"
|
||||
rm "${installer_df}"
|
||||
rmdir "${installer_df}.mount"
|
||||
rm $ONL_CONFIG_TARBALL
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_platform_loader <blockdev> <partno>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Install the platform loader to the given partition.
|
||||
#
|
||||
# The default is to copy the loader to the partition's filesystem.
|
||||
# If 'platform_loader_raw' is specified by the platform, the
|
||||
# loader will be written directly to the partition instead.
|
||||
#
|
||||
############################################################
|
||||
installer_platform_loader() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
|
||||
if [ -f "${installer_dir}/${installer_platform}.itb" ]; then
|
||||
#
|
||||
# Platform-specfic FIT Image already provided.
|
||||
#
|
||||
local loader="${installer_dir}/${installer_platform}.itb"
|
||||
|
||||
elif [ -f "${installer_dir}/onl-loader-fit.itb" ]; then
|
||||
#
|
||||
# Common FIT image.
|
||||
#
|
||||
local loader="${installer_dir}/onl-loader-fit.itb";
|
||||
else
|
||||
installer_say "There is not FIT image available in the installer. This is a bug."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Cannonical name for all ITB files for each platform
|
||||
# is <platform>.itb.
|
||||
#
|
||||
# This allows you to use the ONL platform configuration settings
|
||||
# with your own initrd with constant and consistent naming.
|
||||
#
|
||||
loaderdst="${installer_platform}.itb"
|
||||
|
||||
installer_say "Installing the Open Network Linux Loader..."
|
||||
|
||||
if [ "${platform_loader_raw}" ]; then
|
||||
installer_partition_dd ${blockdev} ${partno} ${loader}
|
||||
else
|
||||
installer_partition_cp ${blockdev} ${partno} ${loader} ${loaderdst}
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_platform_bootconfig <blockdev> <partno>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Generate and write the platform boot-config file
|
||||
# into the given partition.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_platform_bootconfig() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
#
|
||||
# Is there a static boot-config in the installer package?
|
||||
#
|
||||
if [ -f "${installer_dir}/boot-config" ]; then
|
||||
installer_say "Writing boot-config."
|
||||
installer_partition_cp ${blockdev} ${partno} "${installer_dir}/boot-config"
|
||||
fi
|
||||
|
||||
#
|
||||
# Unless the installer contains a boot-config
|
||||
# file it will have to be generated by the first-boot
|
||||
# script in the Loader.
|
||||
#
|
||||
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_platform_swi <blockdev> <partno>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Install the SWI to the given partition.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_platform_swi() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
SWISRC=`ls ${installer_dir}/*.swi`
|
||||
|
||||
if [ -f "${SWISRC}" ]; then
|
||||
if [ ! ${SWIDST} ]; then
|
||||
SWIDST="$(basename ${SWISRC})"
|
||||
fi
|
||||
installer_say "Installing Open Network Linux Software Image (${SWIDST})..."
|
||||
installer_partition_cp ${blockdev} ${partno} ${SWISRC} ${SWIDST}
|
||||
else
|
||||
installer_say "No Open Network Linux Software Image available for installation. Post-install ZTN installation will be required."
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_standard_blockdev_install <blockdev> <p1size> <p2size> <p3size>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <p1size> The size of the loader partition.
|
||||
# <p2size> The size of the /mnt/flash partition.
|
||||
# <p3size> The size of the /mnt/flash2 partition.
|
||||
#
|
||||
# Performs a standard installation for the platform.
|
||||
# Most platform installers will just call this function with the appropriate arguments.
|
||||
#
|
||||
############################################################
|
||||
installer_standard_blockdev_install () {
|
||||
local blockdev=$1
|
||||
local p1size=$2
|
||||
local p2size=$3
|
||||
local p3size=$4
|
||||
local p4size=$5
|
||||
|
||||
# Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2
|
||||
installer_blockdev_format "${blockdev}" "${p1size}" "${p2size}" "${p3size}" "${p4size}"
|
||||
|
||||
# Copy the platform loader to the first partition.
|
||||
installer_platform_loader "${blockdev}" 1
|
||||
|
||||
# Set the boot-config file
|
||||
installer_platform_bootconfig "${blockdev}" 1
|
||||
|
||||
# Copy the packaged SWI to the third partition.
|
||||
installer_platform_swi "${blockdev}" 3
|
||||
|
||||
sync
|
||||
installer_umount_blockdev "${blockdev}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_standard_blockdev_install <blockdev> <p1size> <p2size> <p3size>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
#
|
||||
# Performs a standard recovery for the platform.
|
||||
#
|
||||
############################################################
|
||||
installer_standard_blockdev_recovery() {
|
||||
local blockdev=$1
|
||||
|
||||
# Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2
|
||||
installer_umount_blockdev ${blockdev}
|
||||
installer_say "Re-formatting ${blockdev}."
|
||||
installer_partition_format ${blockdev} 2 mkdosfs
|
||||
installer_partition_format ${blockdev} 3 mkdosfs
|
||||
|
||||
sync
|
||||
installer_umount_blockdev "${blockdev}"
|
||||
}
|
||||
|
||||
##############################
|
||||
#
|
||||
# End of lib.sh
|
||||
#
|
||||
##############################
|
||||
@@ -1,116 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
IARCH=@@IARCH@@
|
||||
|
||||
# Convert build architecture to local architecture
|
||||
case $IARCH in
|
||||
powerpc)
|
||||
IARCH=ppc
|
||||
;;
|
||||
armel)
|
||||
IARCH=armv7l
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" != "$IARCH" ]; then
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
echo "Installer Architecture: $IARCH"
|
||||
echo "Target Architecture: $ARCH"
|
||||
echo
|
||||
echo "This installer cannot be used on this"
|
||||
echo "target."
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
sleep 5
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
|
||||
|
||||
installer_script=${0##*/}
|
||||
installer_zip=$1
|
||||
|
||||
if [ -f /etc/machine.conf ]; then
|
||||
. /etc/machine.conf
|
||||
|
||||
# Running under ONIE, most likely in the background in installer mode.
|
||||
# Our messages have to be sent to the console directly, not to stdout.
|
||||
installer_say() {
|
||||
echo "$@" > /dev/console
|
||||
}
|
||||
# Installation failure message.
|
||||
trap 'installer_say "Install failed.; cat /var/log/onie.log > /dev/console; installer_say "Install failed. See log messages above for details"; sleep 3; reboot' EXIT
|
||||
|
||||
if [ -z "${installer_platform}" ]; then
|
||||
# Our platform identifiers are equal to the ONIE platform identifiers without underscores:
|
||||
installer_platform=`echo ${onie_platform} | tr "_" "-"`
|
||||
installer_arch=${onie_arch}
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Remount tmpfs larger if possible.
|
||||
# We will be doing all of our work out of /tmp
|
||||
#
|
||||
mount -o remount,size=1024M /tmp || true
|
||||
|
||||
|
||||
# Unpack our distribution
|
||||
installer_say "Unpacking Open Network Linux installer files..."
|
||||
installer_dir=`pwd`
|
||||
if test "$SFX_PAD"; then
|
||||
# ha ha, busybox cannot exclude multiple files
|
||||
unzip $installer_zip -x $SFX_PAD
|
||||
elif test "$SFX_UNZIP"; then
|
||||
unzip $installer_zip -x $installer_script
|
||||
else
|
||||
dd if=$installer_zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \
|
||||
| unzip - -x $installer_script
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "${installer_dir}/versions.sh" ]; then
|
||||
. "${installer_dir}/versions.sh"
|
||||
installer_say "${VERSION_STRING} Installer"
|
||||
fi
|
||||
|
||||
installer_say "Detected platform: ${installer_platform}"
|
||||
|
||||
. "${installer_dir}/fit-install-lib"
|
||||
|
||||
# Look for the platform installer directory.
|
||||
installer_platform_dir="${installer_dir}/lib/platform-config/${installer_platform}"
|
||||
if [ -d "${installer_platform_dir}" ]; then
|
||||
# Source the installer scriptlet
|
||||
ONL_PLATFORM=${installer_platform}
|
||||
. "${installer_platform_dir}/onl/install/${installer_platform}.sh"
|
||||
else
|
||||
installer_say "This installer does not support the ${installer_platform} platform."
|
||||
installer_say "Available platforms are:"
|
||||
list=`ls ${installer_dir}/lib/platform-config`
|
||||
installer_say "${list}"
|
||||
installer_say "Installation cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The platform script must provide this function. This performs the actual install for the platform.
|
||||
platform_installer
|
||||
|
||||
installer_say "Configuring system to boot Open Network Linux..."
|
||||
envf=/tmp/.env
|
||||
cp /dev/null "${envf}"
|
||||
echo "nos_bootcmd ${platform_bootcmd}" >> "${envf}"
|
||||
fw_setenv_f_s "${envf}"
|
||||
installer_say "Install finished. Rebooting to Open Network Linux."
|
||||
sleep 3
|
||||
reboot
|
||||
exit 0
|
||||
|
||||
# Do not add any additional whitespace after this point.
|
||||
PAYLOAD_FOLLOWS
|
||||
71
builds/any/installer/sample-postinstall.py
Normal file
71
builds/any/installer/sample-postinstall.py
Normal file
@@ -0,0 +1,71 @@
|
||||
"""sample-postinstall.py
|
||||
|
||||
Example Python script for post-install hooks.
|
||||
|
||||
Add this as a postinstall hook to your installer via
|
||||
the 'mkinstaller.py' command line:
|
||||
|
||||
$ mkinstaller.py ... --plugin sample-postinstall.py ...
|
||||
|
||||
At install time, this script will
|
||||
|
||||
1. be extracted into a temporary working directory
|
||||
2. be imported as a module, in the same process as the installer
|
||||
script
|
||||
|
||||
Importing the module should not trigger any side-effects.
|
||||
|
||||
At the appropriate time during the install (a chrooted invocation
|
||||
of the installer Python script) will
|
||||
|
||||
1. scrape the top-level plugin's namespace for subclasses of
|
||||
onl.install.Plugin.Plugin.
|
||||
Implementors should declare classes here
|
||||
(inheriting from onl.install.Plugin.Plugin) to embed the plugin
|
||||
functionality.
|
||||
2. instantiate an instance of each class, with the installer
|
||||
object initialized as the 'installer' attribute
|
||||
3. invoke the 'run' method (which must be overridden by implementors)
|
||||
For a post-install plugin, the 'mode' argument is set to
|
||||
PLUGIN_POSTINSTALL.
|
||||
4. invoke the 'shutdown' method (by default, a no-op)
|
||||
|
||||
The 'run' method should return zero on success. In any other case, the
|
||||
installer terminates.
|
||||
|
||||
The post-install plugins are invoked after the installer is complete
|
||||
and after the boot loader is updated.
|
||||
|
||||
An exception to this is for proxy GRUB configurations. In that case, the
|
||||
post-install plugins are invoked after the install is finished, but before
|
||||
the boot loader has been updated.
|
||||
|
||||
At the time the post-install plugin is invoked, none of the
|
||||
filesystems are mounted. If the implementor needs to manipulate the
|
||||
disk, the filesystems should be re-mounted temporarily with
|
||||
e.g. MountContext. The OnlMountContextReadWrite object and their
|
||||
siblings won't work here because the mtab.yml file is not populated
|
||||
within the loader environment.
|
||||
|
||||
A post-install plugin should execute any post-install actions when
|
||||
'mode' is set to PLUGIN_POSTINSTALL. If 'mode' is set to any other
|
||||
value, the plugin should ignore it and return zero. The plugin run()
|
||||
method is invoked multiple times during the installer with different
|
||||
values of 'mode'. The 'shutdown()' method is called only once.
|
||||
|
||||
When using MountContxt, the system state in the installer object can help
|
||||
(self.installer.blkidParts in particular).
|
||||
|
||||
"""
|
||||
|
||||
import onl.install.Plugin
|
||||
|
||||
class Plugin(onl.install.Plugin.Plugin):
|
||||
|
||||
def run(self, mode):
|
||||
|
||||
if mode == self.PLUGIN_POSTINSTALL:
|
||||
self.log.info("hello from postinstall plugin")
|
||||
return 0
|
||||
|
||||
return 0
|
||||
42
builds/any/installer/sample-postinstall.sh
Normal file
42
builds/any/installer/sample-postinstall.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
######################################################################
|
||||
#
|
||||
# sample-postinstall.sh
|
||||
#
|
||||
# Example script for post-install hooks.
|
||||
#
|
||||
# Add this as a postinstall hook to your installer via
|
||||
# the 'mkinstaller.py' command line:
|
||||
#
|
||||
# $ mkinstaller.py ... --postinstall-script sample-postinstall.sh ...
|
||||
#
|
||||
# At install time, this script will
|
||||
#
|
||||
# 1. be extracted into the working directory with the other installer
|
||||
# collateral
|
||||
# 2. have the execute bit set
|
||||
# 3. run in-place with the installer chroot directory passed
|
||||
# as the first command line parameter
|
||||
#
|
||||
# If the script fails (returns a non-zero exit code) then
|
||||
# the install is aborted.
|
||||
#
|
||||
# This script is executed using the ONIE runtime (outside the chroot),
|
||||
# after the actual installer (chrooted Python script) has finished.
|
||||
#
|
||||
# This script is run after the postinstall actions (e.g. proxy GRUB
|
||||
# commands)
|
||||
#
|
||||
# At the time the script is run, the installer environment (chroot)
|
||||
# is fully prepared, including filesystem mount-points.
|
||||
# That is, the chroot mount points have not been unmounted yet.
|
||||
#
|
||||
######################################################################
|
||||
|
||||
rootdir=$1; shift
|
||||
|
||||
echo "Hello from postinstall"
|
||||
echo "Chroot is $rootdir"
|
||||
|
||||
exit 0
|
||||
61
builds/any/installer/sample-preinstall.py
Normal file
61
builds/any/installer/sample-preinstall.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""sample-preinstall.py
|
||||
|
||||
Example Python script for pre-install hooks.
|
||||
|
||||
Add this as a preinstall hook to your installer via
|
||||
the 'mkinstaller.py' command line:
|
||||
|
||||
$ mkinstaller.py ... --plugin sample-preinstall.py ...
|
||||
|
||||
At install time, this script will
|
||||
|
||||
1. be extracted into a temporary working directory
|
||||
2. be imported as a module, in the same process as the installer
|
||||
script
|
||||
|
||||
Importing the module should not trigger any side-effects.
|
||||
|
||||
At the appropriate time during the install (a chrooted invocation
|
||||
of the installer Python script) will
|
||||
|
||||
1. scrape the top-level plugin's namespace for subclasses of
|
||||
onl.install.Plugin.Plugin.
|
||||
Implementors should declare classes here
|
||||
(inheriting from onl.install.Plugin.Plugin) to embed the plugin
|
||||
functionality.
|
||||
2. instantiate an instance of each class, with the installer
|
||||
object initialized as the 'installer' attribute
|
||||
3. invoke the 'run' method (which must be overridden by implementors)
|
||||
For a pre-install plugin, the 'mode' argument is set to
|
||||
PLUGIN_PREINSTALL.
|
||||
4. invoke the 'shutdown' method (by default, a no-op)
|
||||
|
||||
The 'run' method should return zero on success. In any other case, the
|
||||
installer terminates.
|
||||
|
||||
The 'installer' object has a handle onto the installer ZIP archive
|
||||
(self.installer.zf) but otherwise the install has not been
|
||||
started. That is, the install disk has not been
|
||||
prepped/initialized/scanned yet. As per the ONL installer API, the
|
||||
installer starts with *no* filesystems mounted, not even the ones from
|
||||
a prior install.
|
||||
|
||||
A pre-install plugin should execute any pre-install actions when
|
||||
'mode' is set to PLUGIN_PREINSTALL. If 'mode' is set to any other
|
||||
value, the plugin should ignore it and return zero. The plugin run()
|
||||
method is invoked multiple times during the installer with different
|
||||
values of 'mode'. The 'shutdown()' method is called only once.
|
||||
|
||||
"""
|
||||
|
||||
import onl.install.Plugin
|
||||
|
||||
class Plugin(onl.install.Plugin.Plugin):
|
||||
|
||||
def run(self, mode):
|
||||
|
||||
if mode == self.PLUGIN_PREINSTALL:
|
||||
self.log.info("hello from preinstall plugin")
|
||||
return 0
|
||||
|
||||
return 0
|
||||
38
builds/any/installer/sample-preinstall.sh
Normal file
38
builds/any/installer/sample-preinstall.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
######################################################################
|
||||
#
|
||||
# sample-preinstall.sh
|
||||
#
|
||||
# Example script for pre-install hooks.
|
||||
#
|
||||
# Add this as a preinstall hook to your installer via
|
||||
# the 'mkinstaller.py' command line:
|
||||
#
|
||||
# $ mkinstaller.py ... --preinstall-script sample-preinstall.sh ...
|
||||
#
|
||||
# At install time, this script will
|
||||
#
|
||||
# 1. be extracted into the working directory with the other installer
|
||||
# collateral
|
||||
# 2. have the execute bit set
|
||||
# 3. run in-place with the installer chroot directory passed
|
||||
# as the first command line parameter
|
||||
#
|
||||
# If the script fails (returns a non-zero exit code) then
|
||||
# the install is aborted.
|
||||
#
|
||||
# This script is executed using the ONIE runtime (outside the chroot),
|
||||
# before the actual installer (chrooted Python script)
|
||||
#
|
||||
# At the time the script is run, the installer environment (chroot)
|
||||
# has been fully prepared, including filesystem mount-points.
|
||||
#
|
||||
######################################################################
|
||||
|
||||
rootdir=$1; shift
|
||||
|
||||
echo "Hello from preinstall"
|
||||
echo "Chroot is $rootdir"
|
||||
|
||||
exit 0
|
||||
@@ -2,109 +2,28 @@ ifndef ARCH
|
||||
$(error $$ARCH not set)
|
||||
endif
|
||||
|
||||
ONLPLATFORM = python $(ONL)/tools/onlplatform.py
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:$(ARCH))
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad --fixup-perms autoperms.sh
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
VONLDIR = $(ONL)/packages/base/all/vendor-config-onl
|
||||
PYFIT = $(VONLDIR)/src/bin/pyfit
|
||||
PYFIT_ENVIRONMENT = PYTHONPATH=$(VONLDIR)/src/python
|
||||
ifndef BOOTMODE
|
||||
$(error $$BOOTMODE not set)
|
||||
endif
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_INSTALLER
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_$(BOOTMODE)_INSTALLER
|
||||
|
||||
# default fit image can be used as the canonical location for the initrd
|
||||
FIT_IMAGE_ALL := $(shell $(ONLPM) --find-file onl-loader-fit:$(ARCH) onl-loader-fit.itb)
|
||||
INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:$(ARCH) onl-loader-initrd-$(ARCH).cpio.gz)
|
||||
INITRD_BOUNDS := $(shell $(PYFIT_ENVIRONMENT) $(PYFIT) -v offset $(FIT_IMAGE_ALL) --initrd)
|
||||
MKINSTALLER_OPTS = \
|
||||
--arch $(ARCH) \
|
||||
--boot-config boot-config \
|
||||
--add-dir config \
|
||||
--fit onl-loader-fit:$(ARCH) onl-loader-fit.itb \
|
||||
--swi onl-swi:$(ARCH) \
|
||||
--preinstall-script $(ONL)/builds/any/installer/sample-preinstall.sh \
|
||||
--postinstall-script $(ONL)/builds/any/installer/sample-postinstall.sh \
|
||||
--plugin $(ONL)/builds/any/installer/sample-preinstall.py \
|
||||
--plugin $(ONL)/builds/any/installer/sample-postinstall.py \
|
||||
# THIS LINE INTENTIONALLY LEFT BLANK
|
||||
|
||||
__installer: installer.sh __installer_fit_files __installer_platform_files __installer_swi_files
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in installer.sh *.swi *.itb version-onl.sh boot-config
|
||||
$(ONL_V_at)rm -rf installer.sh *.itb *.swi version-onl.sh autoperms.sh
|
||||
$(ONL_V_at)md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
__installer:
|
||||
$(ONL)/tools/mkinstaller.py $(MKINSTALLER_OPTS) --out $(INSTALLER_NAME)
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
installer.sh: Makefile $(ONL)/builds/any/installer/installer.sh.in
|
||||
$(ONL_V_GEN)cp /dev/null $@
|
||||
$(ONL_V_at): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
if test "$(INITRD_BOUNDS)"; then \
|
||||
a="$(FIT_IMAGE_ALL)"; a=$${a##*/} ;\
|
||||
else \
|
||||
a="$(INITRD)"; i=$${a##*/} ;\
|
||||
fi ;\
|
||||
set dummy $(INITRD_BOUNDS); start=$$2; end=$$3; sz=$$(($$end - $$start + 1)) ;\
|
||||
sed \
|
||||
-e 's^@ONLVERSION@^$(VERSION_STRING)^g' \
|
||||
-e "s^@INITRD_ARCHIVE@^$${a}^g" \
|
||||
-e "s^@INITRD_OFFSET@^$$start^g" \
|
||||
-e "s^@INITRD_SIZE@^$$sz^g" \
|
||||
-e 's^@ARCH@^$(ARCH)^g' \
|
||||
$(ONL)/builds/any/installer/installer.sh.in \
|
||||
>> $@
|
||||
$(ONL_V_at)echo "PAYLOAD_FOLLOWS" >> $@
|
||||
|
||||
__installer_fit_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
src=$(FIT_IMAGE_ALL) ;\
|
||||
dst=$${src##*/} ;\
|
||||
if test "$$dst" -nt Makefile; then \
|
||||
: ;\
|
||||
else \
|
||||
echo "Staging $$dst" ;\
|
||||
cp $$src $$dst ;\
|
||||
fi ;\
|
||||
:
|
||||
|
||||
##############################
|
||||
#
|
||||
# optionally include custom itb files for each platform
|
||||
#
|
||||
##############################
|
||||
|
||||
__installer_platform_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
l="$(PLATFORMS)"; for p in $$l; do \
|
||||
echo "Looking for an ITB specific to $$p, ignore errors..." ;\
|
||||
src=$$($(ONLPLATFORM) $$p $(ARCH) itb) 2>/dev/null || : ;\
|
||||
if test "$$src"; then :; else continue; fi ;\
|
||||
dst=$${src##*/} ;\
|
||||
echo "Found $$dst" ;\
|
||||
if test "$$dst" -nt Makefile; then continue; fi ;\
|
||||
echo "Staging $$dst for $$p" ;\
|
||||
cp "$$src" "$$dst" ;\
|
||||
done ;\
|
||||
:
|
||||
|
||||
__installer_swi_files:
|
||||
ifndef NO_SWI
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
swidir=$$(mktemp -d $(PWD)/swi-d-XXXXXX) ;\
|
||||
$(ONLPM) --extract-dir onl-swi:$(ARCH) $$swidir ;\
|
||||
mv $$swidir/usr/share/onl/packages/$(ARCH)/onl-swi/*.swi . ;\
|
||||
rm -fr $$swidir ;\
|
||||
:
|
||||
else
|
||||
$(ONL_V_GEN):
|
||||
endif
|
||||
|
||||
shar installer: installer
|
||||
|
||||
clean:
|
||||
rm -f *.swi *.installer *.cpio.gz
|
||||
|
||||
@@ -6,9 +6,10 @@ prerequisites:
|
||||
|
||||
common:
|
||||
arch: $ARCH
|
||||
version: $FNAME_RELEASE_ID
|
||||
version: 0.$FNAME_RELEASE_ID
|
||||
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
|
||||
maintainer: support@bigswitch.com
|
||||
support: opennetworklinux@googlegroups.com
|
||||
|
||||
packages:
|
||||
- name: onl-rootfs
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
- pciutils
|
||||
- usbutils
|
||||
- mtd-utils
|
||||
- kexec-tools
|
||||
- i2c-tools
|
||||
- module-init-tools
|
||||
- isc-dhcp-client
|
||||
@@ -75,3 +74,7 @@
|
||||
- unzip
|
||||
- onl-mibs
|
||||
- openssl
|
||||
- gdb
|
||||
- tcpdump
|
||||
- strace
|
||||
- sysstat
|
||||
@@ -8,7 +8,6 @@
|
||||
- smartmontools
|
||||
- grub2
|
||||
- onl-upgrade
|
||||
|
||||
|
||||
|
||||
|
||||
- hw-management
|
||||
- sx-kernel
|
||||
- onl-kernel-3.16-lts-x86-64-all-modules
|
||||
11
builds/any/rootfs/jessie/common/amd64-onl-packages.yml
Normal file
11
builds/any/rootfs/jessie/common/amd64-onl-packages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-upgrade
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
builds/any/rootfs/jessie/common/arm64-base-packages.yml
Normal file
1
builds/any/rootfs/jessie/common/arm64-base-packages.yml
Normal file
@@ -0,0 +1 @@
|
||||
- u-boot-tools
|
||||
9
builds/any/rootfs/jessie/common/arm64-onl-packages.yml
Normal file
9
builds/any/rootfs/jessie/common/arm64-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
1
builds/any/rootfs/jessie/common/armel-base-packages.yml
Normal file
1
builds/any/rootfs/jessie/common/armel-base-packages.yml
Normal file
@@ -0,0 +1 @@
|
||||
- u-boot-tools
|
||||
9
builds/any/rootfs/jessie/common/armel-onl-packages.yml
Normal file
9
builds/any/rootfs/jessie/common/armel-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
- u-boot-tools
|
||||
- onl-loader-fit
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: initdev
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Set up block and net devices
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
log_action_begin_msg "Setting up block and net devices"
|
||||
|
||||
ln -snf /proc/mounts /etc/mtab
|
||||
|
||||
( cd /sys/class/block; for d in *; do /sbin/initblockdev $d add; done )
|
||||
if [ -d /sys/class/ubi ]; then
|
||||
( cd /sys/class/ubi; for d in *; do /sbin/initblockdev $d add; done )
|
||||
fi
|
||||
( cd /sys/class/net; for d in *; do /sbin/initnetdev $d add; done )
|
||||
|
||||
initmounts
|
||||
|
||||
log_action_end_msg 0
|
||||
@@ -1,19 +1,19 @@
|
||||
mounts:
|
||||
ONL-IMAGES:
|
||||
mount: r
|
||||
mount: ro
|
||||
dir: /mnt/onl/images
|
||||
fsck: true
|
||||
|
||||
ONL-DATA:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/data
|
||||
|
||||
ONL-CONFIG:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/config
|
||||
fsck: true
|
||||
|
||||
ONL-BOOT:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/boot
|
||||
fsck: false
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
C: US
|
||||
ST: CA
|
||||
O: Open Compute Project
|
||||
localityName: Santa Clara
|
||||
commonName: Networking
|
||||
organizationalUnitName: Open Network Linux
|
||||
emailAddress: support@bigswitch.com
|
||||
@@ -1,3 +1,4 @@
|
||||
logfacility = LOG_USER
|
||||
allowsftp
|
||||
allowscp
|
||||
umask = 022
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
exec 9<$0
|
||||
flock -x 9
|
||||
case $2 in
|
||||
add)
|
||||
eval $(echo $1 | sed "s#^\(mmcblk[0-9]*\|ubi[0-9]*_[0-9]*\|mtdblock[0-9]*\|[a-z]*\)\(p[0-9]*\|[0-9]*\).*#dev='\1' part='\2'#")
|
||||
if [ -e /etc/onl/recover ]; then
|
||||
recover=$(cat /etc/onl/recover)
|
||||
fi
|
||||
devid=
|
||||
if [ -e /sys/class/ubi/${dev}/device ]; then
|
||||
eval $(realpath /sys/class/ubi/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#")
|
||||
fi
|
||||
if [ -e /sys/class/block/${dev}/device ]; then
|
||||
eval $(realpath /sys/class/block/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#")
|
||||
fi
|
||||
while read i n; do
|
||||
expr match "$i" "#" >/dev/null && continue || :
|
||||
[ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && mount=/mnt/$n && break || :
|
||||
expr match "@${dev}" "$i" >/dev/null && mount=/mnt/$n && break || :
|
||||
done </etc/onl/block
|
||||
[ -n "${mount}" ]
|
||||
if [ "$(dd if=/dev/${dev}${part} bs=1 count=6 2>/dev/null)" = "070701" ]; then
|
||||
mount=${mount}-recover
|
||||
else
|
||||
mkdir -p ${mount}
|
||||
[ $(stat -c %D ${mount}) = $(stat -c %D /mnt) ]
|
||||
if [ "$(dd if=/dev/${dev}${part} bs=1 skip=82 count=5 2>/dev/null)" = "FAT32" ] \
|
||||
|| [ "$(dd if=/dev/${dev}${part} bs=1 skip=54 count=5 2>/dev/null)" = "FAT16" ]; then
|
||||
if [ ! -e /etc/onl/kdump ]; then
|
||||
if [ "$recover" = "fsck" ]; then
|
||||
# Try to repair FAT filesystem automatically to prevent further
|
||||
# damage (but skip it in kdump to save time and memory)
|
||||
if dosfsck -a /dev/${dev}${part} >/dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
mount -o flush,dirsync,noatime,umask=0007 /dev/${dev}${part} ${mount} 2>/dev/null
|
||||
else
|
||||
mount -o noatime /dev/${dev}${part} ${mount} 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
echo -e "devid='${devid}'\ndev='${dev}'\npart='${part}'" >${mount}.conf
|
||||
;;
|
||||
remove)
|
||||
mtab=$(mktemp /tmp/tmp.XXXXXX)
|
||||
cp /proc/mounts ${mtab}
|
||||
while read dev mount x; do
|
||||
if [ /dev/$1 = "${dev}" ]; then
|
||||
rm -f ${mount}.conf
|
||||
umount -l ${mount} 2>/dev/null || :
|
||||
fi
|
||||
done <${mtab}
|
||||
rm -f ${mtab}
|
||||
;;
|
||||
esac
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
############################################################
|
||||
- u-boot-tools
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
|
||||
9
builds/any/rootfs/jessie/common/powerpc-onl-packages.yml
Normal file
9
builds/any/rootfs/jessie/common/powerpc-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
Packages: &Packages
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/common-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/all-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-onl-packages.yml
|
||||
- !script $ONL/tools/onl-platform-pkgs.py ${PLATFORM_LIST}
|
||||
|
||||
Multistrap:
|
||||
@@ -83,11 +87,19 @@ Configure:
|
||||
securetty: False
|
||||
ttys: False
|
||||
console: True
|
||||
PermitRootLogin: 'yes'
|
||||
|
||||
users:
|
||||
root:
|
||||
password: onl
|
||||
|
||||
manifest:
|
||||
version: $ONL/make/versions/version-onl.json
|
||||
platforms: $PLATFORM_LIST
|
||||
manifests:
|
||||
'/etc/onl/rootfs/manifest.json' :
|
||||
version : $ONL/make/versions/version-onl.json
|
||||
platforms : $PLATFORM_LIST
|
||||
|
||||
issue: $VERSION_STRING
|
||||
|
||||
files:
|
||||
remove:
|
||||
- /etc/motd
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
- pciutils
|
||||
- usbutils
|
||||
- mtd-utils
|
||||
- kexec-tools
|
||||
- i2c-tools
|
||||
- module-init-tools
|
||||
- isc-dhcp-client
|
||||
@@ -74,3 +73,7 @@
|
||||
- unzip
|
||||
- onl-mibs
|
||||
- openssl
|
||||
- gdb
|
||||
- tcpdump
|
||||
- strace
|
||||
- sysstat
|
||||
11
builds/any/rootfs/wheezy/common/amd64-onl-packages.yml
Normal file
11
builds/any/rootfs/wheezy/common/amd64-onl-packages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-upgrade
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
mounts:
|
||||
ONL-IMAGES:
|
||||
mount: r
|
||||
mount: ro
|
||||
dir: /mnt/onl/images
|
||||
fsck: true
|
||||
|
||||
ONL-DATA:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/data
|
||||
|
||||
ONL-CONFIG:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/config
|
||||
fsck: true
|
||||
|
||||
ONL-BOOT:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/boot
|
||||
fsck: false
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
C: US
|
||||
ST: CA
|
||||
O: Open Compute Project
|
||||
localityName: Santa Clara
|
||||
commonName: Networking
|
||||
organizationalUnitName: Open Network Linux
|
||||
emailAddress: support@bigswitch.com
|
||||
@@ -1,3 +1,4 @@
|
||||
logfacility = LOG_USER
|
||||
allowsftp
|
||||
allowscp
|
||||
umask = 022
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
SUBSYSTEM=="block", RUN+="/sbin/initblockdev $kernel $env{ACTION}"
|
||||
@@ -1 +0,0 @@
|
||||
SUBSYSTEM=="net", RUN+="/sbin/initnetdev $kernel $env{ACTION}"
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
exec 9<$0
|
||||
flock -x 9
|
||||
case $2 in
|
||||
add)
|
||||
eval $(echo $1 | sed "s#^\(mmcblk[0-9]*\|ubi[0-9]*_[0-9]*\|mtdblock[0-9]*\|[a-z]*\)\(p[0-9]*\|[0-9]*\).*#dev='\1' part='\2'#")
|
||||
if [ -e /etc/onl/recover ]; then
|
||||
recover=$(cat /etc/onl/recover)
|
||||
fi
|
||||
devid=
|
||||
if [ -e /sys/class/ubi/${dev}/device ]; then
|
||||
eval $(realpath /sys/class/ubi/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#")
|
||||
fi
|
||||
if [ -e /sys/class/block/${dev}/device ]; then
|
||||
eval $(realpath /sys/class/block/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#")
|
||||
fi
|
||||
while read i n; do
|
||||
expr match "$i" "#" >/dev/null && continue || :
|
||||
[ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && mount=/mnt/$n && break || :
|
||||
expr match "@${dev}" "$i" >/dev/null && mount=/mnt/$n && break || :
|
||||
done </etc/onl/block
|
||||
[ -n "${mount}" ]
|
||||
if [ "$(dd if=/dev/${dev}${part} bs=1 count=6 2>/dev/null)" = "070701" ]; then
|
||||
mount=${mount}-recover
|
||||
else
|
||||
mkdir -p ${mount}
|
||||
[ $(stat -c %D ${mount}) = $(stat -c %D /mnt) ]
|
||||
if [ "$(dd if=/dev/${dev}${part} bs=1 skip=82 count=5 2>/dev/null)" = "FAT32" ] \
|
||||
|| [ "$(dd if=/dev/${dev}${part} bs=1 skip=54 count=5 2>/dev/null)" = "FAT16" ]; then
|
||||
if [ ! -e /etc/onl/kdump ]; then
|
||||
if [ "$recover" = "fsck" ]; then
|
||||
# Try to repair FAT filesystem automatically to prevent further
|
||||
# damage (but skip it in kdump to save time and memory)
|
||||
if dosfsck -a /dev/${dev}${part} >/dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
mount -o flush,dirsync,noatime,umask=0007 /dev/${dev}${part} ${mount} 2>/dev/null
|
||||
else
|
||||
mount -o noatime /dev/${dev}${part} ${mount} 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
echo -e "devid='${devid}'\ndev='${dev}'\npart='${part}'" >${mount}.conf
|
||||
;;
|
||||
remove)
|
||||
mtab=$(mktemp /tmp/tmp.XXXXXX)
|
||||
cp /proc/mounts ${mtab}
|
||||
while read dev mount x; do
|
||||
if [ /dev/$1 = "${dev}" ]; then
|
||||
rm -f ${mount}.conf
|
||||
umount -l ${mount} 2>/dev/null || :
|
||||
fi
|
||||
done <${mtab}
|
||||
rm -f ${mtab}
|
||||
;;
|
||||
esac
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
############################################################
|
||||
- u-boot-tools
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
|
||||
9
builds/any/rootfs/wheezy/common/powerpc-onl-packages.yml
Normal file
9
builds/any/rootfs/wheezy/common/powerpc-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
Packages: &Packages
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/common-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/all-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-onl-packages.yml
|
||||
- !script $ONL/tools/onl-platform-pkgs.py ${PLATFORM_LIST}
|
||||
|
||||
Multistrap:
|
||||
@@ -65,8 +69,6 @@ Configure:
|
||||
- 'nfs-common remove'
|
||||
- 'rpcbind remove'
|
||||
- 'motd remove'
|
||||
- 'kexec remove'
|
||||
- 'kexec-load remove'
|
||||
- 'mountall-bootclean.sh remove'
|
||||
- 'mountall.sh remove'
|
||||
- 'checkfs.sh remove'
|
||||
@@ -85,11 +87,20 @@ Configure:
|
||||
securetty: False
|
||||
ttys: False
|
||||
console: True
|
||||
PermitRootLogin: 'yes'
|
||||
|
||||
users:
|
||||
root:
|
||||
password: onl
|
||||
|
||||
manifest:
|
||||
version: $ONL/make/versions/version-onl.json
|
||||
platforms: $PLATFORM_LIST
|
||||
manifests:
|
||||
'/etc/onl/rootfs/manifest.json' :
|
||||
version : $ONL/make/versions/version-onl.json
|
||||
platforms : $PLATFORM_LIST
|
||||
|
||||
issue: $VERSION_STRING
|
||||
|
||||
files:
|
||||
remove:
|
||||
- /etc/motd
|
||||
|
||||
|
||||
@@ -7,9 +7,10 @@ prerequisites:
|
||||
|
||||
common:
|
||||
arch: $ARCH
|
||||
version: $FNAME_RELEASE_ID
|
||||
version: 0.$FNAME_RELEASE_ID
|
||||
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
|
||||
maintainer: support@bigswitch.com
|
||||
support: opennetworklinux@googlegroups.com
|
||||
|
||||
packages:
|
||||
- name: onl-swi
|
||||
|
||||
1
builds/arm64/Makefile
Normal file
1
builds/arm64/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/arch-build.mk
|
||||
1
builds/arm64/installer/installed/PKG.yml
Normal file
1
builds/arm64/installer/installed/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=arm64 BOOTMODE=installed
|
||||
3
builds/arm64/installer/installed/builds/Makefile
Normal file
3
builds/arm64/installer/installed/builds/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
BOOTMODE=INSTALLED
|
||||
include $(ONL)/make/config.arm64.mk
|
||||
include $(ONL)/builds/any/installer/uboot/builds/Makefile
|
||||
3
builds/arm64/installer/installed/builds/boot-config
Normal file
3
builds/arm64/installer/installed/builds/boot-config
Normal file
@@ -0,0 +1,3 @@
|
||||
NETDEV=ma1
|
||||
BOOTMODE=INSTALLED
|
||||
SWI=images::latest
|
||||
2
builds/arm64/installer/installed/builds/config/README
Normal file
2
builds/arm64/installer/installed/builds/config/README
Normal file
@@ -0,0 +1,2 @@
|
||||
This partition contains system configuration data that is persistant across installations and upgrades of ONL-based systems.
|
||||
|
||||
1
builds/arm64/installer/swi/PKG.yml
Normal file
1
builds/arm64/installer/swi/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=arm64 BOOTMODE=swi
|
||||
1
builds/arm64/installer/swi/builds/.gitignore
vendored
Normal file
1
builds/arm64/installer/swi/builds/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*INSTALLER
|
||||
3
builds/arm64/installer/swi/builds/Makefile
Normal file
3
builds/arm64/installer/swi/builds/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
BOOTMODE=SWI
|
||||
include $(ONL)/make/config.arm64.mk
|
||||
include $(ONL)/builds/any/installer/uboot/builds/Makefile
|
||||
@@ -1,4 +1,3 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
2
builds/arm64/installer/swi/builds/config/README
Normal file
2
builds/arm64/installer/swi/builds/config/README
Normal file
@@ -0,0 +1,2 @@
|
||||
This partition contains system configuration data that is persistant across installations and upgrades of ONL-based systems.
|
||||
|
||||
1
builds/arm64/rootfs/Makefile
Normal file
1
builds/arm64/rootfs/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
1
builds/arm64/rootfs/PKG.yml
Normal file
1
builds/arm64/rootfs/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/rootfs/APKG.yml ARCH=arm64
|
||||
2
builds/arm64/rootfs/builds/.gitignore
vendored
Normal file
2
builds/arm64/rootfs/builds/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.d/
|
||||
manifest.json
|
||||
14
builds/arm64/rootfs/builds/Makefile
Normal file
14
builds/arm64/rootfs/builds/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
include $(ONL)/make/config.arm64.mk
|
||||
|
||||
#
|
||||
# Default to include all available arm64 platforms.
|
||||
# You override this with you own list or yaml file.
|
||||
#
|
||||
export PLATFORM_LIST=$(shell onlpm --list-platforms --arch arm64 --csv )
|
||||
|
||||
RFS_CONFIG := $(ONL)/builds/any/rootfs/$(ONL_DEBIAN_SUITE)/standard/standard.yml
|
||||
RFS_DIR := rootfs-arm64.d
|
||||
RFS_CPIO := rootfs-arm64.cpio.gz
|
||||
RFS_SQUASH := rootfs-arm64.sqsh
|
||||
|
||||
include $(ONL)/make/rfs.mk
|
||||
1
builds/arm64/swi/PKG.yml
Normal file
1
builds/arm64/swi/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/swi/APKG.yml ARCH=arm64
|
||||
1
builds/arm64/swi/builds/.gitignore
vendored
Normal file
1
builds/arm64/swi/builds/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
manifest.json
|
||||
3
builds/arm64/swi/builds/Makefile
Normal file
3
builds/arm64/swi/builds/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
ROOTFS_PACKAGE := onl-rootfs
|
||||
include $(ONL)/make/config.arm64.mk
|
||||
include $(ONL)/make/swi.mk
|
||||
@@ -1 +1 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
include $(ONL)/make/arch-build.mk
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=armel
|
||||
1
builds/armel/installer/installed/PKG.yml
Normal file
1
builds/armel/installer/installed/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=armel BOOTMODE=installed
|
||||
1
builds/armel/installer/installed/builds/.gitignore
vendored
Normal file
1
builds/armel/installer/installed/builds/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*INSTALLER
|
||||
3
builds/armel/installer/installed/builds/Makefile
Normal file
3
builds/armel/installer/installed/builds/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
BOOTMODE=INSTALLED
|
||||
include $(ONL)/make/config.armel.mk
|
||||
include $(ONL)/builds/any/installer/uboot/builds/Makefile
|
||||
3
builds/armel/installer/installed/builds/boot-config
Normal file
3
builds/armel/installer/installed/builds/boot-config
Normal file
@@ -0,0 +1,3 @@
|
||||
NETDEV=ma1
|
||||
BOOTMODE=INSTALLED
|
||||
SWI=images::latest
|
||||
2
builds/armel/installer/installed/builds/config/README
Normal file
2
builds/armel/installer/installed/builds/config/README
Normal file
@@ -0,0 +1,2 @@
|
||||
This partition contains system configuration data that is persistant across installations and upgrades of ONL-based systems.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=armel
|
||||
@@ -1,3 +0,0 @@
|
||||
*INSTALLER
|
||||
fit-install*
|
||||
boot-config
|
||||
@@ -1,2 +0,0 @@
|
||||
include $(ONL)/make/config.armel.mk
|
||||
include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile
|
||||
1
builds/armel/installer/swi/PKG.yml
Normal file
1
builds/armel/installer/swi/PKG.yml
Normal file
@@ -0,0 +1 @@
|
||||
!include $ONL/builds/any/installer/APKG.yml ARCH=armel BOOTMODE=swi
|
||||
1
builds/armel/installer/swi/builds/.gitignore
vendored
Normal file
1
builds/armel/installer/swi/builds/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*INSTALLER
|
||||
@@ -1,2 +1,3 @@
|
||||
BOOTMODE=SWI
|
||||
include $(ONL)/make/config.armel.mk
|
||||
include $(ONL)/builds/any/installer/uboot/builds/Makefile
|
||||
@@ -1,4 +1,3 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user