Lets have some fun. Why bother writing the same shit again and again when we build a desktop iso. Let's write a buildscript :)

Here's a very basic build script.

cat -n Kali-Desktop-Light.sh
     1	#!/bin/bash
     2	# Kali Desktop Build-script
     3	# nx <This email address is being protected from spambots. You need JavaScript enabled to view it.>
     4	# Version 1.0 - 05-03-2020
     5	# Adapted for new meta-packages from kali.org
     6	#
     7	# Vars, HDIR = ROOT mappe, BDIR=/$HDIR/live-build-config 
     8	HDIR=/root
     9	BDIR=live-build-config
    10	
    11	### System Setup
    12	
    13	cd $HDIR
    14	
    15	## Update system
    16	apt-get update
    17	apt-get upgrade -y
    18	
    19	## Install live-build packages
    20	apt-get install live-build cdebootstrap -y
    21	
    22	# Clone from Kali-org
    23	git clone http://gitlab.com/kalilinux/build-scripts/live-build-config.git
    24	
    25	#cd to live-build-config
    26	
    27	cd $BDIR
    28	cd kali-config
    29	
    30	cp -r variant-light variant-desktop
    31	
    32	mkdir -p variant-desktop/includes.chroot
    33	mkdir -p variant-desktop/includes.chroot/etc
    34	mkdir -p variant-desktop/package-lists
    35	mkdir -p variant-desktop/includes.chroot/etc/apt/
    36	mkdir -p variant-desktop/includes.chroot/boot/grub
    37	
    38	#Download webmin
    39	
    40	#wget http://prdownloads.sourceforge.net/webmin
    41	#tar -xzf webmin-1.910.tar.gz
    42	#cp -r webmin-1.910 webmin
    43	#cp -r webmin variant-desktop/includes.chroot/etc/
    44	# rmdir webmin
    45	
    46	#Write package list
    47	
    48	cd variant-desktop
    49	rm package-lists/kali.list.chroot
    50	touch package-lists/kali.list.chroot
    51	cat >> package-lists/kali.list.chroot << EOF
    52	
    53	# Basic packages
    54	
    55	kali-linux-core
    56	kali-desktop-live
    57	kali-desktop-xfce
    58	kali-root-login
    59	#Default settings for Kali
    60	kali-defaults
    61	kali-menu
    62	kali-debtags
    63	kali-archive-keyring
    64	debian-installer-launcher
    65	alsa-tools
    66	locales-all
    67	xorg
    68	
    69	# Custom basic packages
    70	
    71	mc
    72	net-tools
    73	sysv-rc-conf
    74	openssh-server
    75	
    76	#Office
    77	
    78	libreoffice
    79	libreoffice-help-da
    80	libreoffice-l10n-da
    81	evolution
    82	evolution-plugins
    83	evolution-plugins-experimental
    84	inkscape
    85	scribus
    86	
    87	#messenger
    88	
    89	pidgin
    90	pidgin-otr
    91	pidgin-encryption
    92	qtox
    93	tox
    94	
    95	# Crypto
    96	
    97	tor
    98	gpg
    99	
   100	EOF
   101	
   102	cd $HDIR/$BDIR
   103	
   104	# Build iso image 
   105	
   106	# ./build.sh --distribution kali-rolling --variant desktop --verbose
   107	
   108	exit 0

So, what's all this then ?
Lets try and break it down, and see what it all does. Just a very quick walkthrough.

1-7 - Credits

8-9 - Setup some variables we will need later.

15	## Update system
16	apt-get update
17	apt-get upgrade -y
18	
19	## Install live-build packages
20	apt-get install live-build cdebootstrap -y
21	
22	# Clone from Kali-org
23	git clone http://gitlab.com/kalilinux/build-scripts/live-build-config.git
24	

16-17 - Update system APT

20 - Install packages we need for later. live-build and cdebootstrap.

23 - Clone Kali git repo into /root/live-build-config

25	#cd to live-build-config
26	
27	cd $BDIR
28	cd kali-config
29	
30	cp -r variant-light variant-desktop
31	
32	mkdir -p variant-desktop/includes.chroot
33	mkdir -p variant-desktop/includes.chroot/etc
34	mkdir -p variant-desktop/package-lists
35	mkdir -p variant-desktop/includes.chroot/etc/apt/
36	mkdir -p variant-desktop/includes.chroot/boot/grub
37	

30 - Take the default folder, variant-light, used for building the official "light" image, and copy it to variant-desktop

32-36 - Setup some folders we'll need later.

48	cd variant-desktop
49	rm package-lists/kali.list.chroot
50	touch package-lists/kali.list.chroot
51	cat >> package-lists/kali.list.chroot << EOF
52	
53	# Basic packages
54	
55	kali-linux-core
56	kali-desktop-live
57	kali-desktop-xfce
58	kali-root-login
59	#Default settings for Kali
60	kali-defaults
61	kali-menu
62	kali-debtags
63	kali-archive-keyring
64	debian-installer-launcher
65	alsa-tools
66	locales-all
67	xorg
68	
69	# Custom basic packages
70	
71	mc
72	net-tools
73	sysv-rc-conf
74	openssh-server
75	
76	#Office
77	
78	libreoffice
79	libreoffice-help-da
80	libreoffice-l10n-da
81	evolution
82	evolution-plugins
83	evolution-plugins-experimental
84	inkscape
85	scribus
86	
87	#messenger
88	
89	pidgin
90	pidgin-otr
91	pidgin-encryption
92	qtox
93	tox
94	
95	# Crypto
96	
97	tor
98	gpg
99	
100	EOF

48 - Jump into variant-desktop folder

49 - Remove the standard package.list from Kali

50 - Make new package.list file, so we're ready to write the new package-names into it.

51 - Start to cat package names into config file.

52- 100 Write package-names into the new package-list, until we reach EOF.

102 cd $HDIR/$BDIR
103	
104	# Build iso image 
105	
106	# ./build.sh --distribution kali-rolling --variant desktop --verbose

102 - Jump into /root/live-build-config

106 - Let's rock. Build the image

 

You have no rights to post comments