Permalink
Switch branches/tags
Nothing to show
Find file Copy path
9126f8e Apr 19, 2017
Christopher Horrell make pkg silent
2 contributors

Users who have contributed to this file

@chorrell @MerlinDMC
executable file 123 lines (94 sloc) 3.32 KB
PARTITIONS=vtbd0
DISTRIBUTIONS="kernel.txz base.txz joyent.txz"
BSDINSTALL_DISTSITE=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.3-RELEASE
#!/bin/sh
set -o xtrace
echo "==> Running installerconfig"
# Enable serial and internal consoles
echo "==> Enabling serial and internal consoles"
echo "-Dhv" > /boot.config
echo "cuau0 \"/usr/libexec/getty std.38400\" xterm on secure" >> /etc/ttys
echo "==> Adding boot loader settings"
cat << BOOT > /boot/loader.conf
autoboot_delay="5"
verbose_loading="YES"
hw.snd.default_auto=0
hw.usb.disable_enumeration=1
hw.usb.no_boot_wait=1
hw.usb.no_shutdown_wait=1
BOOT
echo "==> Setting up rc.conf"
cat > /etc/rc.conf << RC_CONF
fsck_y_enable="YES"
# Enable SmartDataCenter support. Do not remove.
smartdc_enable="YES"
sshd_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
RC_CONF
# Set Time Zone to UTC
echo "==> Setting Time Zone to UTC"
/bin/cp /usr/share/zoneinfo/UTC /etc/localtime
/usr/bin/touch /etc/wall_cmos_clock
/sbin/adjkerntz -a
# Fetch and install binary updates. Ensures we have the latest security fixes.
echo "==> Running freebsd-update fetch and freebsd-update install"
# Remove src from update since it's not installed
# See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198030
sed -i.bak -e s/Components\ src\ world\ kernel/Components\ world\ kernel/g /etc/freebsd-update.conf
cat << FREEBSDUPDATE > /tmp/freebsd-update.conf
KeyPrint 800651ef4b4c71c27e60786d7b487188970f4b4169cc055784e21eb71d410cc5
ServerName update.FreeBSD.org
Components world/base kernel
IgnorePaths
IDSIgnorePaths /usr/share/man/cat
IDSIgnorePaths /usr/share/man/whatis
IDSIgnorePaths /var/db/locate.database
IDSIgnorePaths /var/log
UpdateIfUnmodified /etc/ /var/ /root/ /.cshrc /.profile
MergeChanges /etc/ /boot/device.hints
BackupKernel no
FREEBSDUPDATE
env PAGER=cat freebsd-update -f /tmp/freebsd-update.conf fetch
env PAGER=cat freebsd-update -f /tmp/freebsd-update.conf install
echo "==> Installing packages"
env ASSUME_ALWAYS_YES=YES pkg update -f
env ASSUME_ALWAYS_YES=YES pkg upgrade -q -y
env ASSUME_ALWAYS_YES=YES pkg install -q -y bash curl node npm vim-lite wget
env ASSUME_ALWAYS_YES=YES pkg autoremove
env ASSUME_ALWAYS_YES=YES pkg clean -a
echo "== Enable root login via ssh"
sed -i.bak -e s/#PermitRootLogin\ no/PermitRootLogin\ without-password/g /etc/ssh/sshd_config
## Build date used for motd and product file
BUILDDATE=$(date +%Y%m%d)
RELEASE="10.3-RELEASE"
DOC_URL="https://docs.joyent.com/images/kvm/freebsd"
# Create MOTD
echo "Creating /etc/motd"
mv /etc/motd /etc/motd-backup
cat << MOTD > /etc/motd
__ . .
_| |_ | .-. . . .-. :--. |-
|_ _| ;| || |(.-' | | |
|__| \`--' \`-' \`;-| \`-' ' ' \`-'
/ ; Instance (FreeBSD $RELEASE $BUILDDATE)
\`-' $DOC_URL
MOTD
# Create product file
echo "Creating /etc/product file"
cat << PRODUCT > /etc/product
Name: Joyent Instance
Image: FreeBSD $RELEASE $BUILDDATE
Documentation: $DOC_URL
Description: FreeBSD $RELEASE 64-bit image with just essential packages \
installed. Ideal for users who are comfortable with setting up their \
own environment and tools.
PRODUCT
echo "Cleaning up"
rm -rf /tmp/installscript
rm -rf /var/db/freebsd-update/*
rm -rf /tmp/freebsd-update.conf
rm -rf /boot/kernel/*.symbols
echo "End of installerconfig"
# Shutdown/Poweroff
poweroff