-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpengwin-create-targz.sh
More file actions
71 lines (56 loc) · 1.96 KB
/
pengwin-create-targz.sh
File metadata and controls
71 lines (56 loc) · 1.96 KB
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
69
70
71
#!/bin/bash
# create our environment
set -e
BUILDIR=$(pwd)
TMPDIR=$(mktemp -d)
ARCH=""
DIST="testing"
cd $TMPDIR
function build {
# install script dependencies
sudo apt-get -y -q update
sudo apt-get -y -q install curl gnupg cdebootstrap
# bootstrap image
sudo cdebootstrap -a $ARCH --include=sudo,locales,git,ssh,gnupg,apt-transport-https,wget,ca-certificates,man,less,curl,bash-completion,vim $DIST $DIST http://deb.debian.org/debian
# download and install pengwin-base and pengwin-setup
sudo curl "https://salsa.debian.org/rhaist-guest/WSL/raw/master/linux_files/profile" -so "${TMPDIR}/${DIST}/etc/profile"
sudo cp $BUILDIR/pengwin_linux_files/setup $TMPDIR/$DIST/etc/setup
sudo chroot $DIST /bin/bash -c "bash /etc/setup --silent --install"
# configure initial language settings
sudo chroot $DIST /bin/bash -c "echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen"
sudo chroot $DIST /bin/bash -c "update-locale LANGUAGE=en_US.UTF-8 LC_ALL=C"
# configure sudo lecture
sudo chroot $DIST /bin/bash -c "echo 'Defaults lecture_file = /etc/sudoers.lecture' >> /etc/sudoers"
sudo chroot $DIST /bin/bash -c "echo 'Enter your UNIX password below. This is not your Windows password.' > /etc/sudoers.lecture"
# remove unnecessary packages in initial image
sudo chroot $DIST apt-get -y -q remove systemd dmidecode --allow-remove-essential
# clean up any orphaned apt dependencies
sudo chroot $DIST apt-get -y -q autoremove
# clean apt cache
sudo chroot $DIST apt-get -y -q clean
# create tar
cd $DIST
sudo tar --ignore-failed-read -czvf $TMPDIR/install.tar.gz *
# move into place in build folder
cd $TMPDIR
cp install.tar.gz $BUILDIR/$ARCHDIR/
cd $BUILDIR
}
# describe script usage
function usage {
echo "./create-targz.sh <BUILD_ARCHITECTURE>"
echo "Possible architectures: arm64, amd64"
}
# accept argument input for architecture type
ARCH=$@
if [ "$ARCH" = "amd64" ] ; then
ARCH="amd64"
ARCHDIR="x64"
build
elif [ "$ARCH" = "arm64" ] ; then
ARCH="arm64"
ARCHDIR="ARM64"
build
else
usage
fi