This repository was archived by the owner on May 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathpostinstall
executable file
·68 lines (51 loc) · 1.46 KB
/
postinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
#
# NOTE: This script is run within the chroot after second stage debootstrap!
#
set -e
if [ "$#" -ne 5 ]; then
echo "Usage: $0 DIST DIST_URL KERNEL_VERSION ODROID ROOT_RW"
exit 1
fi
DIST=$1
DIST_URL=$2
KERNEL_VERSION=$3
ODROID=$4
ROOT_RW=$5
echo "Running postinstall script..."
# Set root password
echo "root:odroid" | chpasswd
# Set the locale
sed -i "s/^#[[:space:]]*en_US\.UTF-8\(.*\)/en_US\.UTF-8\1/g" /etc/locale.gen
locale-gen
# Set timezone
dpkg-reconfigure -f noninteractive tzdata
# Initialize /etc/apt/sources.list
echo "deb $DIST_URL $DIST main contrib non-free" > /etc/apt/sources.list
echo "deb-src $DIST_URL $DIST main contrib non-free" >> /etc/apt/sources.list
# Update apt
apt-get update
# Generate the initial ramfs
update-initramfs -c -t -k $KERNEL_VERSION
insserv usbmount-start
insserv framebuffer-start
insserv hostname-init
insserv sshd-init
# Prevent apt-get from starting services
echo "#!/bin/sh
exit 101
" > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
# Run custom install scripts
if [ -d /postinst ]; then
find /postinst -maxdepth 1 -type f -executable -not -name "*~" -exec {} "$DIST" "$ODROID" "$ROOT_RW" \;
fi
# Run custom install scripts for a specific distribution
if [ -d /postinst/$DIST ]; then
find /postinst/$DIST -maxdepth 1 -type f -executable -not -name "*~" -exec {} "$DIST" "$ODROID" "$ROOT_RW" \;
fi
# Re-enable services to start
rm /usr/sbin/policy-rc.d
# Cleanup
apt-get clean
rm -rf /var/log/*