forked from Shubhamvis98/kali-pinephone
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pinephone.sh
executable file
·34 lines (25 loc) · 1.02 KB
/
pinephone.sh
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
#!/bin/bash
. funcs.sh
set -e
cd `dirname $0`
# Creating blank image, make partitions and mount for rootfs
mkimg phosh_rel_pp.img 5
echo '[*]Stage 1: Debootstrap'
[ ! -e kali_rootfs/debootstrap/debootstrap ] && [ -e kali_rootfs/etc/passwd ] && echo -e "[*]Debootstrap already done.b\nSkipping Debootstrap..." || debootstrap --foreign --arch $ARCH kali-rolling $ROOTFS http://kali.download/kali
echo '[*]Stage 2: Debootstrap Second Stage'
rsync -rl third_stage $ROOTFS/
[ -e $ROOTFS/etc/passwd ] && echo '[*]Second Stage already done' || nspawn-exec /third_stage/second_stage
cat << EOF > ${ROOTFS}/etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=`blkid -s UUID -o value $ROOT_P` / ext4 defaults 0 1
UUID=`blkid -s UUID -o value $BOOT_P` /boot ext4 defaults 0 2
EOF
echo '[*]Stage 3: Installing Extra Packages'
nspawn-exec /third_stage/third_stage
# Cleanup and Unmount
rm -rf $ROOTFS/third_stage
umount $ROOTFS/boot
umount $ROOTFS
rmdir $ROOTFS
losetup -D
echo '[*]PinePhone Image Generated.'