#!/bin/sh # Install the target-specific hostname, hosts file and hostname service link. set -eu ROOTFS="${1:-}" DEVICE="${2:-nokia-argon}" if [ -z "$ROOTFS" ] || [ ! -d "$ROOTFS" ]; then echo "Usage: $0 " >&2 exit 1 fi case "$DEVICE" in nokia-argon|argon) DEVICE="nokia-argon" ;; nokia-beatles|beatles) DEVICE="nokia-beatles" ;; nokia-tough|nokia-coconut|tough|coconut) DEVICE="nokia-tough" ;; nokia-sparkler|sparkler) DEVICE="nokia-sparkler" ;; nokia-leo|leo) DEVICE="nokia-leo" ;; *) echo "Error: Unsupported device '$DEVICE'." >&2 echo "Supported devices: nokia-argon, nokia-beatles, nokia-tough, nokia-sparkler, nokia-leo" >&2 exit 1 ;; esac mkdir -p "$ROOTFS/etc" "$ROOTFS/etc/runlevels/boot" printf '%s\n' "$DEVICE" > "$ROOTFS/etc/hostname" cat > "$ROOTFS/etc/hosts" <