update image build scripts

This commit is contained in:
Mario Fetka
2012-12-09 11:27:58 +00:00
parent 1da0c7135c
commit cb14beef6d
15 changed files with 873 additions and 6 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
# Path to molecules.git dir
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
export SABAYON_MOLECULE_HOME
# rootfs and bootfs tarball is generated by beaglebone image
export MAKE_TARBALL="0"
exec "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk.sh "${SABAYON_MOLECULE_HOME}"/scripts/mkloopgptdisk_buffalo_ls_xhl_chroot_hook.sh "$@"
+221
View File
@@ -0,0 +1,221 @@
#!/bin/bash
# Path to molecules.git dir
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
export SABAYON_MOLECULE_HOME
ACTION="${1}"
if [ "${ACTION}" != "daily" ] && [ "${ACTION}" != "weekly" ] && [ "${ACTION}" != "dailybase" ]; then
echo "invalid action: ${ACTION}" >&2
exit 1
fi
shift
for arg in "$@"
do
[[ "${arg}" = "--push" ]] && DO_PUSH="1"
[[ "${arg}" = "--stdout" ]] && DO_STDOUT="1"
[[ "${arg}" = "--sleepnight" ]] && DO_SLEEPNIGHT="1"
if [ "${arg}" = "--pushonly" ]; then
DO_PUSH="1"
DRY_RUN="1"
fi
done
CUR_DATE=$(date -u +%Y%m%d)
LOG_FILE="/var/log/molecule/autobuild-${CUR_DATE}-${$}.log"
BUILDING_DAILY=1
MAKE_TORRENTS="${MAKE_TORRENTS:-0}"
DAILY_TMPDIR=
# to make ISO remaster spec files working (pre_iso_script)
export CUR_DATE
export ETP_NONINTERACTIVE=1
export BUILDING_DAILY
# Temporarily added to debug Equo in case of deadlock
# export ETP_DEBUG_WATCHDOG=1
# export ETP_DEBUG_WATCHDOG_INTERVAL=60
echo "DO_PUSH=${DO_PUSH}"
echo "DRY_RUN=${DRY_RUN}"
echo "DO_SLEEPNIGHT=${DO_SLEEPNIGHT}"
echo "LOG_FILE=${LOG_FILE}"
# setup default language, cron might not do that
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
# Sleep until 22pm?
if [ "${DO_SLEEPNIGHT}" = "1" ] && [ "${DO_PUSH}" = "1" ]; then
target_h=22 # 22pm
current_h=$(date +%H)
current_h=${current_h/0} # remove leading 0
delta_h=$(( target_h - current_h ))
if [ ${current_h} -ge 0 ] && [ ${current_h} -le 6 ]; then
# If it's past midnight and no later than 7am
# just push
echo "Just pusing out now"
elif [ ${delta_h} -gt 0 ]; then
delta_s=$(( delta_h * 3600 ))
echo "Sleeping for ${delta_h} hours..."
sleep ${delta_s} || exit 1
elif [ ${delta_h} -lt 0 ]; then
# between 22 and 24, run!
echo "I'm after 22pm, running"
else
echo "No need to sleep"
fi
fi
ARM_SOURCE_SPECS=()
ARM_SOURCE_SPECS_IMG=()
SOURCE_SPECS=()
SOURCE_SPECS_ISO=()
REMASTER_SPECS=()
REMASTER_SPECS_ISO=()
REMASTER_TAR_SPECS=()
REMASTER_TAR_SPECS_TAR=()
if [ "${ACTION}" = "weekly" ] || [ "${ACTION}" = "daily" ]; then
# Weekly molecules
if [ "${ACTION}" = "weekly" ]; then
ARM_SOURCE_SPECS+=(
"sablink-armel-buffalo_kb_pro-20G.spec"
"sablink-armel-buffalo_ls_chlv2-20G.spec"
"sablink-armel-buffalo_ls_pro_live-20G.spec"
"sablink-armel-buffalo_ls_xhl-20G.spec"
)
ARM_SOURCE_SPECS_IMG+=(
"SabLink_Linux_0_armelv5tel_buffalo_kb_pro_20GB.img"
"SabLink_Linux_0_armelv5tel_buffalo_ls_pro_live_20GB.img"
"SabLink_Linux_0_armelv5tel_buffalo_ls_xhl_20GB.img"
"SabLink_Linux_0_armelv5tel_buffalo_ls_chlv2_20GB.img"
)
fi
fi
[[ -d "/var/log/molecule" ]] || mkdir -p /var/log/molecule
cleanup_on_exit() {
if [ -n "${DAILY_TMPDIR}" ] && [ -d "${DAILY_TMPDIR}" ]; then
rm -rf "${DAILY_TMPDIR}"
# don't care about races
DAILY_TMPDIR=""
fi
}
trap "cleanup_on_exit" EXIT INT TERM
move_to_pkg_sablink_org() {
if [ -n "${DO_PUSH}" ] || [ -f "${SABAYON_MOLECULE_HOME}"/DO_PUSH ]; then
rm -f "${SABAYON_MOLECULE_HOME}"/DO_PUSH
local executed=
for ((i=0; i < 5; i++)); do
# rsync -av --partial --delete-excluded "${SABAYON_MOLECULE_HOME}"/images_ftpsync/*DAILY* \
# entropy@pkg.sabayon.org:/sabayon/rsync/rsync.sabayon.org/iso/daily \
# || { sleep 10; continue; }
# rsync -av --partial --delete-excluded "${SABAYON_MOLECULE_HOME}"/scripts/gen_html \
# entropy@pkg.sabayon.org:/sabayon/rsync/iso_html_generator \
# || { sleep 10; continue; }
# ssh entropy@pkg.sabayon.org \
# /sabayon/rsync/iso_html_generator/gen_html/gen.sh \
# || { sleep 10; continue; }
ftpsync "${SABAYON_MOLECULE_HOME}"/images_ftpsync/ ¸
ftp://sablink:`cat ${SABAYON_MOLECULE_HOME}"/pkgs.sablink.n-c.org`@pkgs.sablink.nas-central.org/images
executed=1
break
done
[[ -n "${executed}" ]] && return 0
return 1
fi
return 0
}
build_sablink() {
if [ -z "${DRY_RUN}" ]; then
DAILY_TMPDIR=$(mktemp -d --suffix=.iso_build.sh --tmpdir=/tmp)
[[ -z "${DAILY_TMPDIR}" ]] && return 1
DAILY_TMPDIR_REMASTER="${DAILY_TMPDIR}/remaster"
mkdir "${DAILY_TMPDIR_REMASTER}" || return 1
local arm_source_specs=""
for i in ${!ARM_SOURCE_SPECS[@]}
do
src="${SABAYON_MOLECULE_HOME}/molecules/${ARM_SOURCE_SPECS[i]}"
dst="${DAILY_TMPDIR}/${ARM_SOURCE_SPECS[i]}"
cp "${src}" "${dst}" -p || return 1
echo >> "${dst}"
echo "inner_source_chroot_script: ${SABAYON_MOLECULE_HOME}/scripts/inner_source_chroot_update.sh" >> "${dst}"
# tweak iso image name
sed -i "s/^#.*image_name/image_name:/" "${dst}" || return 1
sed -i "s/image_name.*/image_name: ${ARM_SOURCE_SPECS_IMG[i]}/" "${dst}" || return 1
# tweak release version
sed -i "s/release_version.*/release_version: ${CUR_DATE}/" "${dst}" || return 1
echo "${dst}: image: ${ARM_SOURCE_SPECS_IMG[i]} date: ${CUR_DATE}"
arm_source_specs+="${dst} "
done
local done_images=0
local done_something=0
if [ -n "${arm_source_specs}" ]; then
molecule --nocolor ${arm_source_specs} || return 1
done_something=1
done_images=1
fi
# package phases keep loading dbus, let's kill pids back
ps ax | grep -- "/usr/bin/dbus-daemon --fork .* --session" | awk '{ print $1 }' | xargs kill 2> /dev/null
if [ "${done_something}" = "1" ]; then
if [ "${done_images}" = "1" ]; then
cp -p "${SABAYON_MOLECULE_HOME}"/images/* "${SABAYON_MOLECULE_HOME}"/images_ftpsync/ || return 1
fi
date > "${SABAYON_MOLECULE_HOME}"/images_ftpsync/RELEASE_DATE_DAILY
# if [ "${MAKE_TORRENTS}" != "0" ]; then
# "${SABAYON_MOLECULE_HOME}"/scripts/make_torrents.sh || return 1
# fi
fi
fi
return 0
}
mail_failure() {
local out=${1}
local log_file=${2}
echo "Hello there,
iso_build.sh execution failed (miserably) with exit status: ${out}.
Log file is at ${log_file}.
Thanks,
Sun" | /bin/mail -s "ISO build script failure" root
}
out="0"
if [ -n "${DO_STDOUT}" ]; then
build_sablink
out=${?}
if [ "${out}" = "0" ]; then
move_to_pkg_sablink_org
out=${?}
fi
else
log_file="/var/log/molecule/autobuild-${CUR_DATE}-${$}.log"
build_sablink &> "${log_file}"
out=${?}
if [ "${out}" = "0" ]; then
move_to_pkg_sablink_org &>> "${log_file}"
out=${?}
fi
if [ "${out}" != "0" ]; then
# mail root
mail_failure "${out}" "${log_file}"
fi
fi
echo "EXIT_STATUS: ${out}"
exit ${out}
+295
View File
@@ -0,0 +1,295 @@
#! /bin/sh
# (c) Copyright 2012 Fabio Erculiani <lxnay@sabayon.org>
# Licensed under terms of GPLv2
env-update
. /etc/profile
export LC_ALL=en_US.UTF-8
# Path to molecules.git dir
SABAYON_MOLECULE_HOME="${SABAYON_MOLECULE_HOME:-/sabayon}"
export SABAYON_MOLECULE_HOME
# Expected env variables:
# PATHS_TO_REMOVE = ";" separated list of paths to rm -rf
# PATHS_TO_EMPTY = ";" separated list of paths to rm -rf (keeping the dir)
# RELEASE_STRING
# RELEASE_VERSION
# RELEASE_DESC
# RELEASE_FILE
# IMAGE_NAME
# DESTINATION_IMAGE_DIR
# PACKAGES_TO_ADD
# PACKAGES_TO_REMOVE
if [ ${#} -ne 5 ]; then
echo "usage: ${0} <path to regular file containing the image> <size in Mb> <source boot files dir> <source chroot>"
exit 1
fi
CHROOT_SCRIPT="${1}"
if [ ! -x "${CHROOT_SCRIPT}" ]; then
echo "${CHROOT_SCRIPT} is not executable"
exit 1
fi
FILE="${2}"
SIZE="${3}"
BOOT_DIR="${4}"
CHROOT_DIR="${5}"
# Should we make a tarball of the rootfs and bootfs?
MAKE_TARBALL="${MAKE_TARBALL:-1}"
# Boot partition type
BOOT_PART_TYPE="${BOOT_PART_TYPE:-ext2}"
BOOT_PART_TYPE_GPT="${BOOT_PART_TYPE_GPT:-8300}"
BOOT_PART_MKFS_ARGS="${BOOT_PART_MKFS_ARGS:--L Boot -I 128}"
# Root partition type
ROOT_PART_TYPE="${ROOT_PART_TYPE:-btrfs}"
ROOT_PART_MKFS_ARGS="${ROOT_PART_MKFS_ARGS:--L SabLink}"
# Swap partiton arguments
SWAP_PART_MKFS_ARGS="${SWAP_PART_MKFS_ARGS:--L Swap}"
# Copy /boot content from Root partition to Boot partition?
BOOT_PART_TYPE_INSIDE_ROOT="${BOOT_PART_TYPE_INSIDE_ROOT:-1}"
cleanup_loopbacks() {
cd /
sync
sync
sleep 5
sync
[[ -n "${tmp_file}" ]] && rm "${tmp_file}" 2> /dev/null
[[ -n "${tmp_dir}" ]] && { umount "${tmp_dir}/proc" &> /dev/null; }
[[ -n "${tmp_dir}" ]] && { umount "${tmp_dir}" &> /dev/null; rmdir "${tmp_dir}" &> /dev/null; }
[[ -n "${boot_tmp_dir}" ]] && { umount "${boot_tmp_dir}" &> /dev/null; rmdir "${boot_tmp_dir}" &> /dev/null; }
sleep 1
[[ -n "${boot_part}" ]] && losetup -d "${boot_part}" 2> /dev/null
[[ -n "${root_part}" ]] && losetup -d "${root_part}" 2> /dev/null
[[ -n "${DRIVE}" ]] && losetup -d "${DRIVE}" 2> /dev/null
# make sure to have run this
[[ -n "${tmp_dir}" ]] && CHROOT_DIR="${tmp_dir}" "${SABAYON_MOLECULE_HOME}"/scripts/mmc_remaster_post.sh
}
trap "cleanup_loopbacks" 1 2 3 6 9 14 15 EXIT
# Erase the file
echo "Generating the empty image file at ${FILE}"
dd if=/dev/zero of="${FILE}" bs=1024000 count="${SIZE}"
[[ "$?" != "0" ]] && exit 1
echo "Configured the loopback partition at ${FILE}"
# Calculate size using fdisk
SIZE=$(sgdisk -p "${FILE}" | grep First | awk '{print $10}')
# Magic first partition size, given 300MB below
BOOTSIZE="616447"
BOOTOFFSET="2048"
SWAPSIZE="4194304"
echo "Disk size : ${SIZE} Sectors"
echo "Disk sectors : ${SECTORS}"
echo "Magic size : Sector ${BOOTSIZE} (boot part size 300MB)"
echo "Start offset : Sector ${BOOTOFFSET}"
# this will create a first partition that is 300MB long
# Starts at sect 2048, ends at sect 616447, each sector is 512bytes
sgdisk -n 1:${BOOTOFFSET}:${BOOTSIZE} -t 1:${BOOT_PART_TYPE_GPT} ${FILE}
# Start of Root is 1 sector after the Boot Part
ROOTOFFSET=$((BOOTSIZE+1))
# Swap starts 2GB bevore end of Disk
SWAPOFFSET=$((SIZE-SWAPSIZE))
# root ends 1 sector before swap starts
ROOTSIZE=$((SWAPOFFSET-1))
sgdisk -n 2:${ROOTOFFSET}:${ROOTSIZE} -t 2:${BOOT_PART_TYPE_GPT} ${FILE}
sgdisk -n 3:${SWAPOFFSET}:${SIZE} -t 3:8200 ${FILE}
echo "create compatibility hybrid MBR"
# sgdisk still not support the possibility to make the ee part non 1
echo "r
h
1
n
83
y
n
w
y" | gdisk ${FILE}
sleep 2
sgdisk -p "${FILE}"
# each sector has 512bytes
LOOPDEVICE=$(kpartx -v -l "${FILE}" | grep deleted | awk '{print $4}')
echo "Loop Device ${LOOPDEVICE}"
LOOPNAME=${LOOPDEVICE##*/}
echo "Loop Device Name ${LOOPNAME}"
echo "Create loop devces"
# Get two loopback devices first
part=$(kpartx -v -a "${FILE}")
if [ -z "${part}" ]; then
echo "Cannot setup the partitions loopbacks"
exit 1
fi
boot_part="/dev/mapper/${LOOPNAME}p1"
root_part="/dev/mapper/${LOOPNAME}p2"
swap_part="/dev/mapper/${LOOPNAME}p3"
echo "Boot Partiton at : ${boot_part}"
echo "Root Partition at : ${root_part}"
# Format boot
echo "Formatting ${BOOT_PART_TYPE} ${boot_part}..."
"mkfs.${BOOT_PART_TYPE}" ${BOOT_PART_MKFS_ARGS} "${boot_part}" || exit 1
# Format extfs
echo "Formatting ${ROOT_PART_TYPE} ${root_part}..."
"mkfs.${ROOT_PART_TYPE}" ${ROOT_PART_MKFS_ARGS} "${root_part}" || exit 1
# Format swap
echo "Formatting swap ${swap_part}..."
"mkswap" ${SWAP_PART_MKFS_ARGS} "${swap_part}" || exit 1
boot_tmp_dir=$(mktemp -d)
if [[ -z "${boot_tmp_dir}" ]]; then
echo "Cannot create temporary dir (boot)"
exit 1
fi
chmod 755 "${boot_tmp_dir}" || exit 1
tmp_dir=$(mktemp -d)
if [[ -z "${tmp_dir}" ]]; then
echo "Cannot create temporary dir"
exit 1
fi
chmod 755 "${tmp_dir}" || exit 1
sleep 2
sync
echo "Setting up the boot directory content, mounting on ${boot_tmp_dir}"
mount "${boot_part}" "${boot_tmp_dir}"
cp -R "${BOOT_DIR}"/* "${boot_tmp_dir}"/ || exit 1
echo "Setting up the extfs directory content, mounting on ${tmp_dir}"
mount "${root_part}" "${tmp_dir}"
rsync -a -H -A -X --delete-during "${CHROOT_DIR}"/ "${tmp_dir}"/ --exclude "/proc/*" --exclude "/sys/*" \
--exclude "/dev/pts/*" --exclude "/dev/shm/*" || exit 1
CHROOT_DIR="${tmp_dir}" "${SABAYON_MOLECULE_HOME}"/scripts/remaster_pre.sh || exit 1
# Configure 00-board-setup.start
source_board_setup="${SABAYON_MOLECULE_HOME}/boot/arm_startup/00-board-setup.start"
dest_board_setup="${CHROOT_DIR}/etc/local.d/00-board-setup.start"
if [ -f "${source_board_setup}" ]; then
echo "Setting up ${dest_board_setup}"
cp "${source_board_setup}" "${dest_board_setup}" || exit 1
chmod 755 "${dest_board_setup}" || exit 1
chown root:root "${dest_board_setup}" || exit 1
fi
# execute PACKAGES_TO_ADD and PACKAGES_TO_REMOVE
export ETP_NONINTERACTIVE=1
# Entropy doesn't like non-UTF locale encodings
export LC_ALL=en_US.UTF-8
# do I have to run "equo update?"
# If we are running outside the DAILY scope, it's
# better to do it here. If instead we're doing a
# DAILY, this is already done by other scripts.
if [ -z "$(basename ${IMAGE_NAME} | grep DAILY)" ]; then
FORCE_EAPI=2 chroot "${tmp_dir}" equo update || \
FORCE_EAPI=2 chroot "${tmp_dir}" equo update || \
exit 1
fi
if [ -n "${PACKAGES_TO_ADD}" ]; then
add_cmd="equo install ${PACKAGES_TO_ADD}"
chroot "${tmp_dir}" ${add_cmd} || exit 1
fi
if [ -n "${PACKAGES_TO_REMOVE}" ]; then
rem_cmd="equo remove ${PACKAGES_TO_REMOVE}"
chroot "${tmp_dir}" ${rem_cmd} || exit 1
fi
# execute CHROOT_SCRIPT hook inside chroot
chroot_script_name=$(basename "${CHROOT_SCRIPT}")
target_chroot_script="${tmp_dir}"/"${chroot_script_name}"
cp -p "${CHROOT_SCRIPT}" "${target_chroot_script}" || exit 1
chmod 700 "${target_chroot_script}" || exit 1
chown root "${target_chroot_script}" || exit 1
chroot "${tmp_dir}" "/${chroot_script_name}" || exit 1
rm -f "${target_chroot_script}"
CHROOT_DIR="${tmp_dir}" "${SABAYON_MOLECULE_HOME}"/scripts/mmc_remaster_post.sh
# execute final cleanup of entropy stuff
chroot "${tmp_dir}" equo rescue vacuum
# setup sudoers, enable wheel group
if [ -f "${tmp_dir}/etc/sudoers" ]; then
echo "# added by Sabayon Molecule" >> "${tmp_dir}/etc/sudoers"
echo "%wheel ALL=ALL" >> "${tmp_dir}/etc/sudoers"
fi
export LC_ALL=C
# work out paths to empty and paths to remove
if [ -n "${PATHS_TO_REMOVE}" ]; then
set -f
for path in $(echo ${PATHS_TO_REMOVE} | tr ";" "\n"); do
echo "Removing: ${path}"
set +f
rm -rf "${tmp_dir}"/${path}
set -f
done
set +f
fi
if [ -n "${PATHS_TO_EMPTY}" ]; then
set -f
for path in $(echo ${PATHS_TO_EMPTY} | tr ";" "\n"); do
set +f
echo "Emptying: ${path}"
rm -rf "${tmp_dir}"/"${path}"/*
set -f
done
set +f
fi
if [ -n "${RELEASE_FILE}" ]; then
release_file="${tmp_dir}"/"${RELEASE_FILE}"
release_dir=$(dirname "${release_file}")
[[ ! -d "${release_dir}" ]] && { mkdir -p "${release_dir}" || exit 1; }
echo "${RELEASE_STRING} ${RELEASE_VERSION} ${RELEASE_DESC}" > "${release_file}"
fi
# BOOT_PART_TYPE_INSIDE_ROOT
if [ -n "${BOOT_PART_TYPE_INSIDE_ROOT}" ]; then
echo "Copying data from ${tmp_dir}/boot to ${boot_tmp_dir} as requested..."
cp -Rp "${tmp_dir}/boot/"* "${boot_tmp_dir}/" || exit 1
fi
umount "${boot_tmp_dir}" || exit 1
if [ -n "${DESTINATION_IMAGE_DIR}" ] && [ "${MAKE_TARBALL}" = "1" ]; then
# Create the rootfs tarball
ROOTFS_TARBALL="${DESTINATION_IMAGE_DIR}/${IMAGE_NAME}.rootfs.tar.xz"
echo "Creating the roofs tarball: ${ROOTFS_TARBALL}"
tmp_file=$(mktemp --suffix=.tar.xz)
[[ -z "${tmp_file}" ]] && exit 1
cd "${tmp_dir}" || exit 1
tar --numeric-owner --preserve-permissions --same-owner -cJf "${tmp_file}" ./ || exit 1
mv "${tmp_file}" "${ROOTFS_TARBALL}" || exit 1
chmod 644 "${ROOTFS_TARBALL}" || exit 1
cd "$(dirname "${ROOTFS_TARBALL}")" || exit 1
md5sum "$(basename "${ROOTFS_TARBALL}")" > "$(basename "${ROOTFS_TARBALL}")".md5
fi
umount "${tmp_dir}" || exit 1
cleanup_loopbacks
kpartx -v -d "${FILE}"
kpartx -v -d "${FILE}"
echo "Your GPT Disk image \"${FILE}\" is ready"
@@ -15,7 +15,9 @@ setup_boot() {
# Linkstation Pro/Live Deamon
rc-update add micro-evtd-boot boot
rc-update add micro-evtd default
rc-update add vixie-cron boot
# add ntp service
rc-update add ntp-client default
rc-update add ntpd default
# enable dbus, of course, and also NetworkManager
rc-update add dbus boot
@@ -87,7 +89,7 @@ setup_fallback_network() {
}
setup_fstab() {
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!ext4!g" -i /etc/fstab
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!btrfs!g" -i /etc/fstab
}
setup_layman() {
+105
View File
@@ -0,0 +1,105 @@
#!/bin/sh
# This script is executed inside the image chroot before packing up.
# Architecture/platform specific code goes here, like kernel install
# and configuration
env-update
. /etc/profile
setup_boot() {
# enable sshd by default
rc-update add sshd default
# enable logger by default
rc-update add syslog-ng boot
rc-update add vixie-cron boot
# Linkstation Pro/Live Deamon
rc-update add ntp-client default
rc-update add ntpd default
# enable dbus, of course, and also NetworkManager
rc-update add dbus boot
# we are on eth1 in the ls xhl/chl2 so create the init.d link
ln -sf net.lo /etc/init.d/net.eth1
rc-update add net.eth1 default
# select the first available kernel
eselect uimage set 1
# cleaning up deps
rc-update --update
}
setup_startup_caches() {
mount -t proc proc /proc
/lib/rc/bin/rc-depend -u
# Generate openrc cache
[[ -d "/lib/rc/init.d" ]] && touch /lib/rc/init.d/softlevel
[[ -d "/run/openrc" ]] && touch /run/openrc/softlevel
/etc/init.d/savecache start
/etc/init.d/savecache zap
ldconfig
ldconfig
umount /proc
}
setup_users() {
# setup root password to... root!
echo root:sablink | chpasswd
}
setup_serial() {
# setup serial login
sed -i "s:^s0.*::" /etc/inittab
echo "s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100" >> /etc/inittab
}
setup_fallback_network() {
# setup fallback network
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "# Sablink Core Network Config" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "# DHCP IP / route configuration, with fallback to a static IP / route" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "config_eth1=\"dhcp\"" >> /etc/conf.d/net
echo "fallback_eth1=\"192.168.178.103 netmask 255.255.255.0 broadcast 192.168.178.255\"" >> /etc/conf.d/net
echo "fallback_route_eth1=\"default via 192.168.178.1\"" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "# pure static IP / route configuration, should the above not work even with fallback.." >> /etc/conf.d/net
echo "# (in that case, comment the whole DHCP section and uncomment this one)" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "#config_eth1=\"192.168.11.3 netmask 255.255.255.0 broadcast 192.168.11.255\"" >> /etc/conf.d/net
echo "#routes_eth1=\"default via 192.168.11.1\"" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "# DNS configuration" >> /etc/conf.d/net
echo "#" >> /etc/conf.d/net
echo "" >> /etc/conf.d/net
echo "dns_servers_eth1=\"192.168.178.1\"" >> /etc/conf.d/net
}
setup_fstab() {
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!btrfs!g" -i /etc/fstab
}
setup_layman() {
sed -e "s!/source!/#source!g" -i /etc/make.conf
}
setup_users
setup_boot
setup_serial
setup_startup_caches
setup_fallback_network
setup_fstab
setup_layman
exit 0
@@ -15,7 +15,9 @@ setup_boot() {
# Linkstation Pro/Live Deamon
rc-update add micro-evtd-boot boot
rc-update add micro-evtd default
rc-update add vixie-cron boot
# add ntp sercice
rc-update add ntp-client default
rc-update add ntpd default
# enable dbus, of course, and also NetworkManager
rc-update add dbus boot
@@ -87,7 +89,7 @@ setup_fallback_network() {
}
setup_fstab() {
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!ext4!g" -i /etc/fstab
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!btrfs!g" -i /etc/fstab
}
setup_layman() {
@@ -15,7 +15,6 @@ setup_boot() {
# Linkstation Pro/Live Deamon
rc-update add ntp-client default
rc-update add ntpd default
rc-update add vixie-cron boot
# enable dbus, of course, and also NetworkManager
rc-update add dbus boot
@@ -87,7 +86,7 @@ setup_fallback_network() {
}
setup_fstab() {
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!ext4!g" -i /etc/fstab
sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!btrfs!g" -i /etc/fstab
}
setup_layman() {