TinyCore starts X automatically. However, I would like my TinyCore to
leave me with 4 Linux consoles and their login prompts when it starts.
Then, I can start X manually.
So, I modify my 'tinycore.gz' to change TinyCore's behavior.
** Warning: This could break your TinyCore. **
4c8c4fe2a48c90393bf29528aa6ce7ee tinycore_1.0rc7.iso
'tinycore.gz' dir = /mnt/sda1/tc/
First, I open 'tinycore.gz' in a new directory, tcfs.
root@box:/home/tc# mkdir tcfs
root@box:/home/tc# cd tcfs
root@box:/home/tc/tcfs# gunzip -c /mnt/sda1/tc/tinycore.gz | cpio -idm
Now, I change the passwords for User 'tc' and User 'root'.
In this case, 'whatever' is the password for both.
root@box:/home/tc/tcfs# chpasswd << EOF
> tc:whatever
> root:whatever
> EOF
Then, I modify these files:
1): /home/tc/tcfs/etc/shadow
2): /home/tc/tcfs/etc/inittab
3): /home/tc/tcfs/etc/profile
4): /home/tc/tcfs/etc/skel/.profile
5): /home/tc/tcfs/root/.profile
1): /home/tc/tcfs/etc/shadow
This saves the passwords.
root@box:/home/tc/tcfs# cp /etc/shadow etc/shadow
2): /home/tc/tcfs/etc/inittab
Editing this creates 4 Linux consoles. I use 'askfirst', but
'respawn' is fine too.
root@box:/home/tc/tcfs# vi etc/inittab
# /etc/inittab: init configuration for busybox init.
# Boot-time system configuration/initialization script.
::sysinit:/etc/init.d/rcS
tty1::askfirst:/sbin/getty 38400 tty1
tty2::askfirst:/sbin/getty 38400 tty2
tty3::askfirst:/sbin/getty 38400 tty3
tty4::askfirst:/sbin/getty 38400 tty4
# Stuff to do when restarting the init
# process, or before rebooting.
::restart:/etc/init.d/rc.shutdown
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rc.shutdown
3): /home/tc/tcfs/etc/profile
This file is for my PS1 prompt.
root@box:/home/tc/tcfs# vi etc/profile
# /etc/profile: system-wide .profile file for the Bourne shells
PATH="/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin"
# set a fancy prompt
if [ "`id -u`" -eq 0 ]; then
PS1="\[\033[0;31m\]\u\[\033[0;39m\]@\h\[\033[0;36m\][\w]\[\033[0;39m\]\\$ "
else
PS1="\[\033[1;33m\]\u\[\033[0;39m\]@\h\[\033[0;36m\][\w]\[\033[0;39m\]\\$ "
fi
# Screen display for X and encoding for GTK+ apps.
#
DISPLAY=:0.0
G_FILENAME_ENCODING=iso8859-1
# ldd fake
#
which ldd > /dev/null || alias ldd=LD_TRACE_LOADED_OBJECTS=1
# Export all variables definied above and set mask.
#
export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING ignoreeof
umask 022
if [ -f /etc/sysconfig/language ]; then
. /etc/sysconfig/language
export LANG LC_ALL
fi
if [ -f /etc/sysconfig/timezone ]; then
. /etc/sysconfig/timezone
export TZ
fi
4): /home/tc/tcfs/etc/skel/.profile
PS1 prompt is deleted here. Also, it stops TineCore from starting X automatically.
root@box:/home/tc/tcfs# vi etc/skel/.profile
# ~/.profile: Executed by Bourne-compatible login SHells.
#
. /etc/init.d/tc-functions
if [ -f /etc/sysconfig/language ]; then
. /etc/sysconfig/language
export LANG LC_ALL
fi
if [ -f /etc/sysconfig/timezone ]; then
. /etc/sysconfig/timezone
export TZ
fi
# Path to personal scripts and executables (~/.local/bin).
#
if [ -d "$HOME/.local/bin" ] ; then
PATH=$HOME/.local/bin:$PATH
export PATH
fi
PAGER='less -EM'
export EDITOR PAGER
umask 022
# if ! checkbootparam "text" && [ ! -e /tmp/.X11-unix/X0 ]; then startx; fi
5): /home/tc/tcfs/root/.profile
This breaks TinyCore's function. Without changing this file, I cannot log in
as a root user. However, I don't log in as 'root', therefore, this change
is optional.
root@box:/home/tc/tcfs# vi root/.profile
#!/bin/sh
#. /etc/init.d/tc-functions
#if ! checkbootparam "superuser"; then
#TCUSER="$(cat /etc/sysconfig/tcuser)"
#export HOME=/home/"$TCUSER"
#cd $HOME
#while [ 1 ]; do
# exec su - "$TCUSER"
#done
#fi
Finally, I create new 'tinycore.gz' and save it.
root@box:/home/tc/tcfs# find . | cpio -o -H newc | gzip -9 > ../tinycore.gz
root@box:/home/tc/tcfs# cd -
root@box:/home/tc# cp tinycore.gz /mnt/sda1/tc
root@box:/home/tc# exit
Perhaps, you know a better way to do the same thing.
Please let me know. Thank you.