Use the same kali-finish-install script in live and installer images

This ensures that we do the same set of customizations whatever way
Kali is installed.
merge-requests/16/head
Raphaël Hertzog 4 years ago
parent 208c080989
commit 897caba82b
No known key found for this signature in database
GPG Key ID: 03881DABEBC29AB9

@ -0,0 +1,66 @@
#!/bin/sh
# The reference version of this script is maintained in
# live-build-config/bin/kali-finish-install.
#
# It is used in multiple places to finish configuring the target system
# and build.sh copies it where required (in the simple-cdd configuration
# and in the live-build configuration).
configure_sources_list() {
if grep -q '^deb ' /etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine"
return
fi
echo "INFO: sources.list is empty, setting up a default one for Kali"
cat >/etc/apt/sources.list <<END
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free
# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free
END
apt-get update
}
get_user_list() {
for user in $(cd /home && ls); do
if ! getent passwd "$user" >/dev/null; then
echo "WARNING: user '$user' is invalid but /home/$user exists"
continue
fi
echo "$user"
done
}
configure_zsh() {
if grep -q 'nozsh' /proc/cmdline; then
echo "INFO: user opted out of zsh by default"
return
fi
if [ ! -x /usr/bin/zsh ]; then
echo "INFO: /usr/bin/zsh is not available"
return
fi
for user in $(get_user_list); do
echo "INFO: changing default shell of user '$user' to zsh"
chsh --shell /usr/bin/zsh $user
done
}
configure_kaboxer() {
# Create the group if needed
addgroup --system kaboxer || true
# Add the users to the group
for user in $(get_user_list); do
echo "INFO: adding user '$user' to group 'kaboxer'"
adduser $user kaboxer || true
done
}
configure_sources_list
configure_zsh
configure_kaboxer

@ -212,6 +212,7 @@ case "$IMAGE_TYPE" in
if [ "$NO_CLEAN" = "" ]; then
run_and_log $SUDO lb clean --purge
fi
cp bin/kali-finish-install kali-config/common/includes.installer/
[ $? -eq 0 ] || failure
run_and_log lb config -a $KALI_ARCH $KALI_CONFIG_OPTS "$@"
[ $? -eq 0 ] || failure
@ -259,6 +260,9 @@ case "$IMAGE_TYPE" in
# Tasksel is required in the mirror for debian-cd
echo tasksel >>simple-cdd/profiles/kali.downloads
# Update the postinst script
cp bin/kali-finish-install simple-cdd/profiles/kali.postinst
# Run simple-cdd
cd simple-cdd
run_and_log build-simple-cdd \

@ -0,0 +1,66 @@
#!/bin/sh
# The reference version of this script is maintained in
# live-build-config/bin/kali-finish-install.
#
# It is used in multiple places to finish configuring the target system
# and build.sh copies it where required (in the simple-cdd configuration
# and in the live-build configuration).
configure_sources_list() {
if grep -q '^deb ' /etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine"
return
fi
echo "INFO: sources.list is empty, setting up a default one for Kali"
cat >/etc/apt/sources.list <<END
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free
# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free
END
apt-get update
}
get_user_list() {
for user in $(cd /home && ls); do
if ! getent passwd "$user" >/dev/null; then
echo "WARNING: user '$user' is invalid but /home/$user exists"
continue
fi
echo "$user"
done
}
configure_zsh() {
if grep -q 'nozsh' /proc/cmdline; then
echo "INFO: user opted out of zsh by default"
return
fi
if [ ! -x /usr/bin/zsh ]; then
echo "INFO: /usr/bin/zsh is not available"
return
fi
for user in $(get_user_list); do
echo "INFO: changing default shell of user '$user' to zsh"
chsh --shell /usr/bin/zsh $user
done
}
configure_kaboxer() {
# Create the group if needed
addgroup --system kaboxer || true
# Add the users to the group
for user in $(get_user_list); do
echo "INFO: adding user '$user' to group 'kaboxer'"
adduser $user kaboxer || true
done
}
configure_sources_list
configure_zsh
configure_kaboxer

@ -1,17 +0,0 @@
#!/bin/sh
if grep -q '^deb ' /target/etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine"
exit 0
fi
echo "INFO: sources.list is empty, setting up a default one for Kali"
cat >/target/etc/apt/sources.list <<END
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free
# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free
END
in-target apt-get update || true

@ -0,0 +1,6 @@
#!/bin/sh
# Run the kali-finish-install script to configure the target system
cp /kali-finish-install /target/
in-target /kali-finish-install || true
rm -f /target/kali-finish-install

@ -1,5 +1,12 @@
#!/bin/sh
# The reference version of this script is maintained in
# live-build-config/bin/kali-finish-install.
#
# It is used in multiple places to finish configuring the target system
# and build.sh copies it where required (in the simple-cdd configuration
# and in the live-build configuration).
configure_sources_list() {
if grep -q '^deb ' /etc/apt/sources.list; then
echo "INFO: sources.list is configured, everything is fine"

Loading…
Cancel
Save