martes, diciembre 03, 2013

Linux jukebox 5th round: Hacking slitaz

Una vez generada la ISO y viendo que cumple las funcionalidades básicas empezamos a realizar modificaciones en la misma para personalizarla.

Primero borramos la iso generada:

# cd distro
# rm slitaz-base.iso

Realizamos las modificaciones:

1. Configuración idioma y teclado, arrancará con la configuració por defecto en lugar de preguntar:

# cd jukebox/distro/rootcd/boot/isolinux/
# vi isolinux.cfg
display isolinux.msg
label slitaz
kernel /boot/bzImage
append initrd=/boot/rootfs.gz rw root=/dev/null vga=normal autologin lang=en kmap=es

include common.cfg

2. Añadimos los clientes web:

# cd jukebox/distro/rootfs/var/www/
# tar -xzvf /home/tux/phpmpreloaded-1.1c.tar.gz
# tar -xzvf /home/tux/relaxx-070.tar.gz

3. Añadimos demonios en arranque (mpd lighttpd dropbear):

# cd jukebox/distro/rootfs/etc
# vi rcS.conf

RUN_DAEMONS="dbus hald firewall slim mpd lighttpd dropbear"

Como mpd no tiene un script en init.d debemos añadirlo:

# cd jukebox/distro/rootfs/etc/init.d

# cat mpd

#!/bin/sh
# /etc/init.d/lighttpd: Start, stop and restart web server on SliTaz,
# at boot time or with the command line. Daemons options are configured
# with /etc/daemons.conf
#
. /etc/init.d/rc.functions
. /etc/daemons.conf

NAME=mpd
DESC="music player daemon"
DAEMON=/usr/sbin/mpd
OPTIONS=$MPD_OPTIONS
PIDFILE=/var/run/mpd.pid
KILL_OPTION=--kill

case "$1" in
start)
if [ -f $PIDFILE ] ; then
echo "$NAME already running."
exit 1
fi
echo -n "Starting $DESC: $NAME... "
$DAEMON $OPTIONS
status
;;
stop)
if [ ! -f $PIDFILE ] ; then
echo "$NAME is not running."
exit 1
fi
echo -n "Stopping $DESC: $NAME... "
$DAEMON $KILL_OPTION
rm $PIDFILE
status
;;
restart)
if [ ! -f $PIDFILE ] ; then
echo "$NAME is not running."
exit 1
fi
echo -n "Restarting $DESC: $NAME... "
$DAEMON $KILL_OPTION
rm $PIDFILE
sleep 2
$DAEMON $OPTIONS
status
;;
*)
echo ""
echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
echo ""
exit 1
;;
esac

exit 0

4. Añadimos el usuario tux usamos chroot para ello:

# cd jukebux/distro/rootfs
# chroot .
root@slitaz:/# adduser tux
adduser: /home/tux: File exists
Changing password for tux
New password:
Bad password: too short
Retype password:
Password for tux changed by root
root@slitaz:/# exit
# cd jukebox/rootfs/home/tux
# mkdir .mpd
# mkdir .mpd/playlists
# mkdir music
# cd jukebox/rootfs/home
# chown -R tux:tux tux

Hay que añadir el usuario al grupo audio:

# cd jukebox/rootfs/etc
# vi group
audio:x:20:tux

Regeneramos el rootfs:

# rm jukebox/distro/rootcd/boot
# cd jukebox/distro/rootfs
# find . -print | cpio -o -H newc | gzip -9 > ../rootcd/boot/rootfs.gz

Por último generamos la iso:

# tazlito gen-iso

No hay comentarios: