1#!/bin/bash 2# 3# Copyright (C) 2018 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17 18# NOTE: It is highly recommended that you do not create new wheezy rootfs 19# images. This script is here for forensic purposes only, to understand 20# how the original rootfs was created. 21 22set -e 23 24SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) 25 26. $SCRIPT_DIR/common.sh 27 28chroot_sanity_check 29 30# Remove things pulled in by debootstrap that we do not need 31dpkg -P \ 32 debconf-i18n \ 33 liblocale-gettext-perl \ 34 libtext-charwidth-perl \ 35 libtext-iconv-perl \ 36 libtext-wrapi18n-perl \ 37 python2.6 \ 38 python2.6-minimal \ 39 xz-utils 40 41# We are done with apt; reclaim the disk space 42apt-get clean 43 44# Ensure a getty is spawned on ttyS0, if booting the image manually 45# This also removes the vt gettys, as we may have no vt 46sed -i '/tty[123456]/d' /etc/inittab 47echo "s0:1235:respawn:/sbin/getty 115200 ttyS0 linux" >>/etc/inittab 48 49# Finalize and tidy up the created image 50chroot_cleanup 51