Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to change the default shell. #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion mklive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ usage() {
-g "<pkg> ..." Ignore packages when building the ISO image
-I <includedir> Include directory structure under given path in the ROOTFS
-S "<service> ..." Enable services in the ISO image
-e <shell> Default shell of the root user (must be absolute path).
Set the live.shell kernel argument to change the default shell of anon.
-C "<arg> ..." Add additional kernel command line arguments
-T <title> Modify the bootloader title (default: Void Linux)
-v linux<version> Install a custom Linux version on ISO image (default: linux metapackage)
Expand Down Expand Up @@ -160,6 +162,11 @@ enable_services() {
done
}

change_shell() {
chroot "$ROOTFS" chsh -s "$ROOT_SHELL" root
[ $? -ne 0 ] && die "Failed to change the shell for root"
}

copy_include_directories() {
for includedir in "${INCLUDE_DIRS[@]}"; do
info_msg "=> copying include directory '$includedir' ..."
Expand Down Expand Up @@ -313,7 +320,7 @@ generate_iso_image() {
#
# main()
#
while getopts "a:b:r:c:C:T:Kk:l:i:I:S:s:o:p:g:v:Vh" opt; do
while getopts "a:b:r:c:C:T:Kk:l:i:I:S:e:s:o:p:g:v:Vh" opt; do
case $opt in
a) BASE_ARCH="$OPTARG";;
b) BASE_SYSTEM_PKG="$OPTARG";;
Expand All @@ -326,6 +333,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:S:s:o:p:g:v:Vh" opt; do
i) INITRAMFS_COMPRESSION="$OPTARG";;
I) INCLUDE_DIRS+=("$OPTARG");;
S) SERVICE_LIST="$SERVICE_LIST $OPTARG";;
e) ROOT_SHELL="$OPTARG";;
s) SQUASHFS_COMPRESSION="$OPTARG";;
o) OUTPUT_FILE="$OPTARG";;
p) PACKAGE_LIST="$PACKAGE_LIST $OPTARG";;
Expand Down Expand Up @@ -387,6 +395,7 @@ CURRENT_STEP=0
STEP_COUNT=10
[ "${#INCLUDE_DIRS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1))
[ -n "${IGNORE_PKGS}" ] && STEP_COUNT=$((STEP_COUNT+1))
[ -n "$ROOT_SHELL" ] && STEP_COUNT=$((STEP_COUNT+1))

: ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/lib/syslinux}
: ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub}
Expand Down Expand Up @@ -447,6 +456,11 @@ install_packages
print_step "Enabling services: ${SERVICE_LIST} ..."
enable_services ${DEFAULT_SERVICE_LIST} ${SERVICE_LIST}

if [ -n "$ROOT_SHELL" ]; then
print_step "Changing the root shell ..."
change_shell
fi

if [ "${#INCLUDE_DIRS[@]}" -gt 0 ];then
print_step "Copying directory structures into the rootfs ..."
copy_include_directories
Expand Down