3 # Copyright (C) 2011-2014 Red Hat Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 # supermin doesn't run any RPM %pre or %post scripts. For
20 # libguestfs this doesn't matter, but when trying to boot a real
21 # distro it matters quite a bit. This script runs once, the first
22 # time the appliance boots. It contains a selection of %post scripts
23 # from important packages.
25 # In debootstrap, this is generated from the packages themselves. We
26 # should generate it for supermin too. (XXX)
28 # There is no /etc/fstab in Fedora. It is possibly generated by
29 # Anaconda for a normal distro. Fake one here.
31 /dev/root / ext2 defaults 1 1
34 # This is probably also done by Anaconda.
36 ln -s /proc/mounts /etc/mtab
38 # Also probably Anaconda.
39 cat <<EOF >/etc/sysconfig/network
40 HOSTNAME=localhost.localnet
43 cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eth0
50 # Combined user accounts from all packages. XXX Because useradd and
51 # groupadd are non-readable by non-root, they are not copied into the
54 cat <<EOF >>/etc/passwd
55 sshd:x:74:482:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
56 dbus:x:81:81:System message bus:/:/sbin/nologin
59 cat <<EOF >>/etc/shadow
64 cat <<EOF >>/etc/group
76 cat <<EOF >>/etc/gshadow
89 /bin/systemd-machine-id-setup
90 /bin/systemctl daemon-reexec
93 target="/lib/systemd/system/runlevel2.target"
94 ln -sf "$target" /etc/systemd/system/default.target
95 /bin/systemctl enable getty@.service
98 /bin/systemctl enable sshd.service
99 /bin/systemctl enable sshd-keygen.service
100 chown root.root /var/empty/sshd
103 touch /var/log/messages
104 touch /var/log/secure
105 /bin/systemctl enable rsyslog.service
108 /sbin/chkconfig --add NetworkManager
109 /sbin/chkconfig NetworkManager resetpriorities
110 /bin/systemctl enable NetworkManager.service
112 # Set the root password to empty string.
113 mv /etc/passwd /etc/passwd-
114 sed 's/^root:[^:]*:/root::/' < /etc/passwd- > /etc/passwd
116 # Set up an /etc/issue file.
117 cat <<'EOF' >/etc/issue
119 Welcome to a-fedora-appliance, a small Fedora appliance.
121 Log in with 'root', no password.
125 # Only run this script once.
126 touch /firstboot.done