mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 09:17:08 +00:00
The legacy installers have been removed.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -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,4 +0,0 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
@@ -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,4 +0,0 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
@@ -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
|
||||
@@ -1 +0,0 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -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 +0,0 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
@@ -1,2 +0,0 @@
|
||||
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=powerpc
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
*INSTALLER
|
||||
fit-install*
|
||||
boot-config
|
||||
@@ -1,3 +0,0 @@
|
||||
INSTALLER_EXTRA_FILES=ppc
|
||||
include $(ONL)/make/config.powerpc.mk
|
||||
include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
export LD_LIBRARY_PATH=$( cd $( dirname -- "$0" ) > /dev/null ; pwd )
|
||||
$LD_LIBRARY_PATH/mke2fs $@
|
||||
Reference in New Issue
Block a user