Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 23 Nov 2014, 22:52
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
HOWTO Customize your Boot Image
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 3 [40 Posts]   Goto page: Previous 1, 2, 3
Author Message
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Fri 18 May 2012, 17:39    Post subject:  

hey dude...
if you want to try my changes, i can provide you the iso (puppy linux 4.3.1) and a compressed file with my changes!!!
i am thinking about doing it to the part with the boot options, but i'm not sure of what i'd do...
any sugestion and how-to is really wellcome ...
i've tryed to insert the image as background but it didn't worked...

.tar.gz compressed file with changes!
https://hotfile.com/dl/156261134/b852e3a/new_splash.tar.gz.html

.iso bootable file (puppy linux 4.3.1)
https://hotfile.com/dl/156261449/391b7f3/pup-431_remastered.iso.html

any sugestion, error, request, how-to or anything, you can ask to me...
i'll try as much as possible...
if something is wrong, tell me...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Fri 18 May 2012, 17:42    Post subject:  

if someone can make a better dithering with that image (to create a high quality color-gradient), please, tell me how to do it!!!
the dithering quality is quite poor and horrible...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
midmen

Joined: 20 Jun 2012
Posts: 4

PostPosted: Thu 21 Jun 2012, 13:27    Post subject:  

I am new to this so I appreciate your help and understanding. I was able to open my boot.msg file using Geany (see below). Once opened I was able to make the changes to my splash image. My question has to do with understanding what do the letters in the black boxes do? I believe I read that SI sets the color of the text. What do the others do and where could I find information that explains how to change certain code in my Puppy?

Thank you.

[/img]
image-1.png
 Description   
 Filesize   30.8 KB
 Viewed   435 Time(s)

image-1.png

Back to top
View user's profile Send private message 
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Thu 21 Jun 2012, 14:46    Post subject:  

i don't know what they exactly mean...
but the box CAN is for the image...
the box SI(hex value of 2 chars, from 00 to 0f) is the text color...
but the text color changes according to the colors in the image...
for example:
SI0a is one of the light gray...
with that logo.16 (the one i created)...
with the original, is orange...
to know the exact color, you open the logo.16 with mtpaint...
at left, you have the color pallete...
you choose what color you want...
and then write it in hex, next to SI...
this is how it is my boot.msg (i have different from the iso, i made it even more personal):

FF CANlogo.16.lss
SI08Wait SI0e5SI08 seconds to boot, press SI0e<F2>SI08 for options.SI08
SUB

note: all that is in uppercase, is the black chars in a box (except the F2)...
the boot.msg example is for puppy 4.3.1, and you must use slack or warry, cause you have the option to click on <F3>...
you can change the image name, but you must have an image in lss16...
in this topic i have a step by step explanation of how to convert any image to lss16 with mtpaint...
any help, or question, just ask...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Thu 21 Jun 2012, 14:46    Post subject:  

i don't know what they exactly mean...
but the box CAN is for the image...
the box SI(hex value of 2 chars, from 00 to 0f) is the text color...
but the text color changes according to the colors in the image...
for example:
SI0a is one of the light gray...
with that logo.16 (the one i created)...
with the original, is orange...
to know the exact color, you open the logo.16 with mtpaint...
at left, you have the color pallete...
you choose what color you want...
and then write it in hex, next to SI...
this is how it is my boot.msg (i have different from the iso, i made it even more personal):

FF CANlogo.16.lss
SI08Wait SI0e5SI08 seconds to boot, press SI0e<F2>SI08 for options.SI08
SUB

note: all that is in uppercase, is the black chars in a box (except the F2)...
the boot.msg example is for puppy 4.3.1, and you must use slack or warry, cause you have the option to click on <F3>...
you can change the image name, but you must have an image in lss16...
in this topic i have a step by step explanation of how to convert any image to lss16 with mtpaint...
any help, or question, just ask...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Thu 21 Jun 2012, 15:04    Post subject:  

by the way, all the other changes must be on the scripts itself...
and in some binaries...
for example:
if you use the puppy linux from a fat32 pendrive, it will load the isolinux.bin and the isolinux.sys first...
both of those are binaries that need to be changes with other programs...
there is a script (on puppy 4.3.1, inside pup-431.sfs), located at /etc/rc.d/rc.sysinit
this script is the one that is loaded when the main sfs file is found...
and it loads the modules and that...
i tried to change it, but i screwed everything and gave up...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Thu 21 Jun 2012, 17:41    Post subject:  

espertalhao04 wrote:
by the way, all the other changes must be on the scripts itself...
and in some binaries...
for example:
if you use the puppy linux from a fat32 pendrive, it will load the isolinux.bin and the isolinux.sys first...
both of those are binaries that need to be changes with other programs...
there is a script (on puppy 4.3.1, inside pup-431.sfs), located at /etc/rc.d/rc.sysinit
this script is the one that is loaded when the main sfs file is found...
and it loads the modules and that...
i tried to change it, but i screwed everything and gave up...


rc.sysinit does not do much for the boot process to work with .sfs files .

The main boot work with .sfs files is done in initrd.gz's /init script (not /sbin/init ) .

rc.sysinit works on / already mounted by the kernel in full installations and mounted by /init for frugal installations . '/' meaning the sum of all .sfs and 3.fs layers OR in full installations the topmost directory level .
Back to top
View user's profile Send private message Visit poster's website 
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Thu 21 Jun 2012, 18:02    Post subject:  

/etc/rc.d/rc.sysinit is the script executes as soon as the sfs file is loaded...
you have to see it...
you open it and search for it...
there will be a point where it says that has made a switch root...
and prints done in green...
i know this because i have tested it...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Thu 21 Jun 2012, 20:32    Post subject:  

Code:
#!/bin/ash
#(c) copyright Barry Kauler 2008, puppylinux.com
#2008 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#v404 first release. rewritten from scratch, aiming for simplicity and speed.
#v405 fix for alsa.
#v406 load apm.ko if no acpi.
#v408 explicitly load battery, ac, thermal, fan modules.
#v409 gparted create ext3 part. failed, fixed by making /etc/mtab a symlink.
#v411 fix mouse detection logic.
#v411 can use old network wizard (from 403, based on 400)
#v411 return of 'puppyserialdetect', for usb/ps2 mouse detection only. now 'puppyinputdetect'.
#v411 extra 'sleep 1' as rerwin reports usb mouse may need it some hardware.
#v411 choosemousefunc().
#v412 /etc/DISTRO_SPECS, renamed pup_xxx.sfs, pup_save.2fs etc.
#v412 bugfix usb-storage wait loop.
#w001 ubuntu module-init-tools not configured to support gzipped modules.
#w004 LANG=C, faster. /bin/ash, even faster.
#w463 rerwin: special mwave modem handling.
#w463 mouse scrollwheel fix.
#w468 full-hd-install, write to PUPSTATE after remount r/w.
#w478 moved depmod code up above call to rc.update.
#w481 fix crappy depmod, 'out of memory' in first boot 64MB RAM (no swap).
#v423 k2.6.29.6 dmesg has warning that ehci-hcd should load before uhci-hcd and ohci-hid.
#v424 fix LAYERFS variable.
#v424 fix secondary uevent replay. now finds ssb devices.
#v431 secondary uevent replay, fix for old kernels < 2.6.24

########################################################################
#
# CHANGES by Karl Reimer Godt
# 00.0 : added function for fsckme.flg to boot further or stop booting
# 01.0 : added various debug echos and dumpe2fs to examine ext2 fs -> switched to ext3
# 02.0 : private part :
#   .1 : mount all none fs with   mount_none_fs_func
#   .2 : case have had booted a kernel with mnt/dev feature : mkmissing_tty_func
#   .3 : check_dev_root_func which sould create the link /dev/root -> rdev
#   .4 : check_frugal_full_func
#   .5 : mkmissing_blockdev_func
#   .6 : dev_maj_259_func
#   .7 : device_nodes_fork_func
#   .8 : mk_missing_var_dev_func
#   .9 : pupstate_prev_func
# 03.0 : multiple kernels part :
#   .1 : firmware_dep_func
#   .2 : lib_firmware_func
#   .3 : mondprobe_conf_func
# 04.0 : added additional /tmp/pup_event_skiplist.conf
#   .1 : parsing the content of /etc/[modprobe.d/]modprobe.conf to  /tmp/pup_event_modprobe.conf
# 05.0 : forced loading of uhci_hcd and ohci_hcd similar to ehci_hcd
# 06.0 : only load modules if initstate lesser than 25
#
# 07.0 : still experimenting with echo "SATADRIVES='${BLOCK_SATAD}'" >> /etc/rc.d/PUPSTATE
# 08.0 : force loading of acpi drivers battery , ac , fan
#
# 09.0 : fbcon_func
# 10.0 : echo nox if Xvesa server or in /proc/cmdline
# 11.0 : creating /etc/.fsckme.flg <- commented to shutdown i think
#
# 13.0 : code to sort the pup_event_backend_modprobe logfile
#
# /dev/sda5:
# LABEL="MacPup430_F3"
# UUID="07443de5-1fab-4656-a3ab-7b1c14ccc8c8"
# TYPE="ext3"
# DISTRO_VERSION=430#481#416#218#478#####changethisasrequired#####
# DISTRO_BINARY_COMPAT="puppy"#"ubuntu"#"puppy"#####changethisasrequired#####
# case$DISTRO_BINARY_COMPATin
# ubuntu)
# DISTRO_NAME="JauntyPuppy"
# DISTRO_FILE_PREFIX="upup"
# DISTRO_COMPAT_VERSION="jaunty"
# ;;
# debian)
# DISTRO_NAME="LennyPuppy"
# DISTRO_FILE_PREFIX="dpup"
# DISTRO_COMPAT_VERSION="lenny"
# ;;
# slackware)
# DISTRO_NAME="SlackPuppy"
# DISTRO_FILE_PREFIX="spup"
# DISTRO_COMPAT_VERSION="12.2"
# ;;
# arch)
# DISTRO_NAME="ArchPuppy"
# DISTRO_FILE_PREFIX="apup"
# DISTRO_COMPAT_VERSION="200904"
# ;;
# t2)
# DISTRO_NAME="T2Puppy"
# DISTRO_FILE_PREFIX="tpup"
# DISTRO_COMPAT_VERSION="puppy5"
# ;;
# puppy)#builtentirelyfromPuppyv2.xorv3.xor4.xpetpkgs.
# DISTRO_NAME="Puppy"
# DISTRO_FILE_PREFIX="pup"#"ppa"#"ppa4"#"pup2"#pup4###CHANGEASREQUIRED,recommendlimitfourcharacters###
# DISTRO_COMPAT_VERSION="4"#"2"#4###CHANGEASREQUIRED,recommendsingledigit5,4,3,or2###
# ;;
# esac
# PUPMODE=2
# KERNVER=2.6.30.6-KRG-i486
# ATADRIVES='sda'
# USB_SATAD=''
# PUP_HOME='/'
# Linuxpuppypc2.6.30.6-KRG-i486#1SMPSunJan220:32:12GMT-12011i686GNU/Linux
# Xserver=/usr/X11R7/bin/Xvesa_stripped_upx9
# $LANG=en_US
# today=MonOct2422:46:48CEST2011
# TODO1 : modaliases | sort -d
# TODO2 : /etc/modprobe.d/ in mult_kernels
#
#
#
########################################################################

##+++2012-05-08
Version='1.1 Macpup_F3-Puppy-Linux-430/2 KRG'
usage(){
MSG="
$0 [-V --version | -h --help ]
Bootupscript to load kernel drivers,
update,set network and drives,set locale
and much more . Without it,
the kernel does not do anything.
"
echo "$MSG"
exit $1
}
[ "`echo "$1" | grep -iE '\-V|version'`" ] && { echo -e "\n$0: Version '$Version'\nUse help parameter for more info\n";exit 0; }
[ "`echo "$1" | grep -iE '\-h|help'`" ] && usage 0
[ "$1" ] && usage 1
[ "$DISPLAY" ] && exit 1
##+++2012-05-08

file_system_state(){
echo -n "FILESYSTEM STATE $1: "
dumpe2fs `rdev` | grep -i 'state'
echo
}

load_average(){
echo "$1:`uptime`"
}

fsckme_func_0() {
FSCKME=`find / -maxdepth 3 -type f -iname "*fsckme*"`  ###KRG, for Advanced /sbin/init
echo $FSCKME  ###DBG
if [ -n "$FSCKME" ] ; then  ###KRG

modprobe ehci_hcd
modprobe ohci_hcd
modprobe uhci_hcd
modprobe usbhid

echo -e "\\033[1;31m"' ... '"$FSCKME"' still exists !'
echo
echo -e "\\033[0;31m"'Want to boot anyway [ B ],[ b ] and [ Enter ] ?'
echo -e "\\033[1;32m"'Reboot [ R ],[ r ] and [ Enter ] ?'
echo -e "\\033[0;32m"'Poweroff [ P ],[ p ] and [ Enter ] ?'
echo -e "\\033[1;34m"'Or simply exit rc.sysinit [ Enter ],[ any other key and Enter ] ?'
echo -e "\\033[1;33m"'         ( timeout 60 sec ... -> exit ) '
echo -e "\\033[7;39m"
echo -n '->'
read -t 60 K
echo -e "\\033[0;39m"
if [ "$K" = "R" -o "$K" = "r" ] ; then
echo 'Rebooting ...'
/bin/busybox umount -ar
/bin/busybox reboot
fi

if [ "$K" = "P" -o "$K" = "p" ] ; then
echo "Pow'ring off the computer ..."
/bin/busybox umount -ar
/bin/busybox poweroff
fi

if [ "$K" = "B" -o "$K" = "b" ] ; then
echo 'Continuing booting ...'
else
echo 'Exiting /etc/rc.d/rc.sysinit'
exit
fi
fi
}
fsckme_func_0

export LANG=C

. /etc/rc.d/functions4puppy4
. /etc/DISTRO_SPECS

file_system_state 1

status_func() {
 if [ $1 -eq 0 ];then
  /bin/echo -e "\\033[72G\\033[1;32mdone\\033[0;39m" >/dev/console #green [done] msg.
 else
  /bin/echo -e "\\033[70G\\033[1;31mfailed\\033[0;39m" >/dev/console #red [failed].
  STATUS=0
 fi
 return $1 #return with same status as entry param.
}

loadswap_func() { #w481 made into a function.
 [ "`grep -i 'noswap' /proc/cmdline`" ] && return 0
 echo "LOAD SWAP"
 echo -n "Activating swap partition(s) " >/dev/console
 SWAPS=`fdisk -l | grep ' Linux swap' | cut -f 1 -d ' '`
 if [ "$SWAPS" ];then
 #load a swap partition...
  for ONESWAP in $SWAPS
 do
  [ "`blkid $ONESWAP | grep -iE 'Resume|Hiber'`" ] && continue
  echo -n " $ONESWAP" >/dev/console
  swapon $ONESWAP
  SWAP_STATUS=$((SWAP_STATUS+$?))
  [ $SWAP_STATUS -eq 0 ] && SWAPON="yes"
 done
 status_func $SWAP_STATUS
 fi
 #if no go, try for a swap file...
 if [ "$SWAPON" != "yes" ];then
  SWAPFILE="/pupswap.swp"
  [ "$PSWAPFILE" ] && SWAPFILE="`echo -n "$PSWAPFILE" | cut -f 3 -d ','`"  #/etc/rc.d/PUPSTATE
  if [ -f /initrd${PUP_HOME}${SWAPFILE} ];then
   echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
   swapon /initrd${PUP_HOME}${SWAPFILE}
   status_func $?
   [ $? -eq 0 ] && SWAPON="yes"
  fi
  if [ -f $SWAPFILE ];then
   echo -n "Loading swap file ${SWAPFILE}..." >/dev/console
   swapon $SWAPFILE
   status_func $?
   [ $? -eq 0 ] && SWAPON="yes"
  fi
 fi
 [ "$SWAPON" = 'yes' ] || echo -e "\\033[0;5;31m\n\t\t"'WARNING : NO SWAP could be activated'"\\033[0;39m" #>/dev/console
}

#if have just done a switch_root, output a 'done' message...
#[ -d /initrd ] && status_func 0 #note, /initrd does not exist when a full-hd installation.
[ "`rdev`" ] || status_func 0

###. /etc/rc.d/MODULESCONFIG #modules loading configuration.
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin
STATUS=0

##############MAKE FILESYSTEM USABLE################
#echo "MAKE FILESYSTEM USABLE"
echo -n "Making the filesystem usable..." >/dev/console #need this redirection!
busybox mount -t proc none /proc ;STATUS=$(($STATUS+$?))

#if [ ! -d /initrd ];then #w468
if [ "`rdev`" ];then
 busybox mount -o remount,rw /
 echo 'PUPMODE=2' > /etc/rc.d/PUPSTATE
fi

##+++2012-01-29
mkdir -p /dev/vc;rm -f /dev/vc/11;mknod /dev/vc/11 c 4 11
openvt -c 11 autologinroot
##+++2012-01-29

#w478 moved this code above call to rc.update...
KERNVER="`uname -r`"
KERNMAJ=`echo -n "$KERNVER" | cut -f 3 -d '.' | cut -f 1 -d '-'` #v431
echo 'KERNVER='$KERNVER >> /etc/rc.d/PUPSTATE
. /etc/rc.d/PUPSTATE #variables created at bootup by init script in initrd.
#file_system_state 2

#puppy boot parameters:
if [ "$PUPMODE" = '2' ];then
for item in `cat /proc/cmdline` ;do
case $item in
pfix=*)
    ITEMS=`echo "$item" |cut -f 2 -d '=' |tr ',' ' '`
        for item2 in $ITEMS;do
        case $item2 in
        nox)        echo 'nox' > /tmp/X.status;;
        xorgwizard) mv /etc/X11/xorg.conf /etc/X11/xorg.conf-"`date`";;
        noswap)     SWAPON=yes;;  #fake value,dunno why for now
        noalsa)     echo 'noalsa' >/tmp/pup_event_alsa_cnt ;;
        nofbcon)    NO_FBCON=1  ;;
        pupmode:*) PUPMODE=${item2#*:};sed -i "s/PUPMODE=.*/PUPMODE='$PUPMODE'/" /etc/rc.d/PUPSTATE;. /etc/rc.d/PUPSTATE;;
        fsck)  : ;;  #do filesystem check on lupusave (and host part. if ext2
        clean) : ;;  #file cleanup (simulate version upgrade)
        purge) : ;;  #more radical file cleanup (to fix broken system)
        rdsh)  : ;;  #for developers only (initramfs shell)
        copy)  : ;;  #copy lupu-511.sfs to RAM (slower boot, faster running)
#racy 522
        nocopy) : ;; #do not copy .sfs files to RAM (faster boot, slower running), #racy 522

        pdev1:*) : ;; #The boot partition.
        psubdir:*) : ;; #psubdir=puppies/wary501 Path in which Puppy is installed.

        psavemark:*) : ;; # =2 Partition no. (in boot drive) to save session to.

        pmedia:*) : ;; #Type of media booting from. Choose one of these:
             # usbflash usbhd usbcd ataflash atahd atacd atazip scsihd scsicd cd

        pupsfs:*) : ;; # =sdc1:/puppies/wary501/puppy.sfs Override auto search.
        zdrv:*) : ;;   # =sdc1:/puppies/wary501/zdrv.sfs  Override auto search.
#racy 522
        [0-9]) : ;;  #number of saved sessions to ignore (multisession-CD)
        esac;done
    ;;
*)
[ "`echo "$item" | grep '='`" ] || item="${item}=1"
item=${item//\./XXX}
kp=${item%=*};echo -n "${kp},"
eval $item
export $kp
;;
esac;done
echo
fi

[ $loglevel ] && LOGLEVEL=$loglevel #boot param.
[ $pmedia ] && PMEDIA=$pmedia #boot parameter, broad category of boot media. ex: cd.
[ $pdev1 ] && PDEV1=$pdev1    #boot parameter, partition have booted off. ex: hda3

#redirect all output to a log file (must do after remount rw)...
#[ "$LOGLEVEL" ] ||
exec 1>/tmp/bootsysinit.log 2>&1

load_average '0x00'

alias modprobe='modprobe -b' ##+++2012-02-03

#v409 mount/umount scripts no longer write to /etc/mtab, as gparted failed to create a
#ext3 partition -- dunno why. Instead, now have /etc/mtab a symlink to /proc/mounts...
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab


mkdir -p /dev/pts
busybox mount /dev/pts ;STATUS=$(($STATUS+$?))
mkdir -p /sys
busybox mount -t sysfs none /sys ;STATUS=$(($STATUS+$?))

##v2.20 some apps need shm (shared memory) (ex: xfdiff)...
FREERAM=`free | grep 'Mem:' | tr -s ' ' | cut -f 4 -d ' '` #w481
#if [ ! -d /initrd ];then #weird, only full-hd install needs this for xfdiff.
if [ "`rdev`" ];then
 QTRFREERAM=`expr $FREERAM \/ 4`
 mkdir -p /dev/shm
 mount -t tmpfs -o size=${QTRFREERAM}k shmfs /dev/shm ;STATUS=$(($STATUS+$?))
fi

load_average '0x01'

MY_ADDITIONAL_PART(){

modprobe_conf_func() {

mkdir -p /etc/mult_kernels

if test -f /etc/mult_kernels/modprobe.conf.$KERNVER ; then
cp -f --remove-destination /etc/mult_kernels/modprobe.conf.$KERNVER /etc/modprobe.conf
else
if test -f /etc/modprobe.conf ;then
[ -f /etc/mult_kernels/modprobe.conf.$KERNVER ] || cp /etc/modprobe.conf /etc/mult_kernels/modprobe.conf.$KERNVER
fi
fi

if test -d /etc/mult_kernels/modprobe.d.$KERNVER ; then
rm -f -r /etc/modprobe.d
cp -f -r /etc/mult_kernels/modprobe.d.$KERNVER /etc/modprobe.d
else
if test -d /etc/modprobe.d ; then
[ -d /etc/mult_kernels/modprobe.d.$KERNVER ] || cp -r /etc/modprobe.d /etc/mult_kernels/modprobe.d.$KERNVER
fi
fi

[ -d /etc/mult_kernels/rc.d ] || mkdir /etc/mult_kernels/rc.d
if [ ! -f /etc/mult_kernels/rc.d/MODULESCONFIG.$KERNVER ] ; then
cp /etc/rc.d/MODULESCONFIG /etc/mult_kernels/rc.d/MODULESCONFIG.$KERNVER
else
cp -f /etc/mult_kernels/rc.d/MODULESCONFIG.$KERNVER /etc/rc.d/MODULESCONFIG
fi; }; modprobe_conf_func & ##-2011-11-07 just to be done in /sbin/init ##2012-01-13 not implemented there yet
load_average '1x0a'
#file_system_state 3
etc_firmware_dep_func() {
if test ! -f /etc/modules/firmware.dep.$KERNVER; then
echo "copying firmware.dep" > /dev/console
FWF=`find /etc/modules -type f -name "firmware.dep.*" | head -n 1`
cp "$FWF" /etc/modules/firmware.dep.$KERNVER
fi; } ; etc_firmware_dep_func &
load_average '1x0b'
#file_system_state 4
lib_firmware_func() {
FWD=`find /lib/modules/$KERNVER/ -maxdepth 2 -type d -name "firmware*" | head -n 1`
if test "$FWD" != "" ; then
[ -d /lib/firmware ] && rm -f /lib/firmware/firmware* ##+++2012-04-11
BN=`basename $FWD`
SN=${BN:0:8}
cp -f -r "$FWD"/* /lib/$SN ##+++2012-04-11 to preserve alredy installed special firmware from all-modules directory #+2012-04-21 added /* to "$FWD" --happened before several times
fi
}
lib_firmware_func
load_average '1x0c'
#file_system_state 5

mount_none_fs_func(){
NFS=`cat /proc/filesystems | grep 'nodev' | tr  '\t' ' ' | cut -f 2 -d ' '`
NODEV=`echo "$NFS" | grep -v -E 'pipe|sock|bdev|anon|inotify|aufs|fuse'`

for i in $NODEV ; do
echo
echo "$i"
DIR=`echo "$i" | sed 's#fs$##'`
if [ -z "`busybox mount | grep "$i"`" ] ; then

[ -d /dev/fs/$DIR ] || mkdir -p /dev/fs/$DIR
mount-FULL -v -t $i none /dev/fs/$DIR  ##+-2012-01-11 changed nodev to none

fi
done
};mount_none_fs_func
load_average '1x0d'
mkmissing_tty_func() {
[ -c /dev/tty ] || mknod /dev/tty c 5 0
[ -d /dev/vc ] || mkdir /dev/vc

VTInittab=`cat /etc/inittab | grep -E 'tty|vc' | grep -v -E '^#|^[[:blank:]]*#|^\t*#' | tr -s ' ' | sort -u | grep -o -w -E 'tty[0-9]*$|vc[0-9].*' | grep -o '[0-9]*$'`
for i in $VTInittab ; do
[ -c /dev/vc/$i ] || { rm -f /dev/vc/$i ; mknod /dev/vc/$i c 4 $i ; }
[ -c /dev/tty$i ] || { rm -f /dev/tty$i ; mknod /dev/tty$i c 4 $i ; }
done

[ -c /dev/console ] || { rm -f /dev/console ; mknod /dev/console c 5 1 ; }
[ -c /dev/zero ] || { rm -f /dev/zero ; mknod /dev/zero c 1 5 ; }
[ -c /dev/null ] || { rm -f /dev/null ; mknod /dev/null c 1 3 ; }

[ -d /dev/pts ] || { rm -f /dev/pts;mkdir /dev/pts; }
[ -c /dev/ptmx ] || { rm -f /dev/ptmx;mknod /dev/ptmx c 5 2; }

for i in $(seq 0 4); do
[ -c /dev/ptyp$i ] || { rm -f /dev/ptyp$i;mknod /dev/ptyp$i c 2 $i; }
done

[ -d /dev/fb ] || mkdir /dev/fb
for i in `seq 0 11` ; do
[ -c /dev/fb$i ] || mknod /dev/fb$i c 29 $i
[ -L /dev/fb/$i ] || ln -s ../fb$i /dev/fb/$i
done
};mkmissing_tty_func

#file_system_state 6
load_average '1x0e'
check_dev_root_func() {
RootDevBlockNrs=`dmesg | grep 'Mounted root'| grep -o 'device.*' | tr -d '.' | cut -f 2 -d ' '`

if test -n "$RootDevBlockNrs"; then
MAJ=`echo $RootDevBlockNrs | cut -f 1 -d ':'`
Min=`echo $RootDevBlockNrs | cut -f 2 -d ':'`

RootDevice=`LC_ALL=C ls -l /dev/ | grep -E 'hd|sd' |tr -s ' '| cut -f 5,6,10 -d ' ' | grep -w "^$MAJ" | grep -w "$Min" | tr -s ' ' | cut -f 3,4 -d ' '`  ##BUG : added tr -s ' ' after grep -E 'hd|sd'
#LC_ALL=C ls -l /dev/sda2
#brw-r--r-- 1 root root 8, 2 Jun 12 11:33 /dev/sda2
#LANG=C ls -l /dev/sda2
#brw-r--r-- 1 root root 8, 2 2012-06-12 11:33 /dev/sda2

#LANG=C ls -l /dev/root
#lrwxrwxrwx 1 root root 4 2012-06-15 17:16 /dev/root -> sda2
#LANG=en_US ls -l /dev/root
#lrwxrwxrwx 1 root root 4 2012-06-15 17:16 /dev/root -> sda2

if [ -b /dev/"$RootDevice" ];then
ROOTDEVICE=$RootDevice
else
ROOTDEVICE=NOT_FOUND_BY_SYSINIT
fi
ln -sf $ROOTDEVICE /dev/root
fi
}
check_dev_root_func
load_average '1x0f'
check_frugal_full_func() {
CatProcPart=`cat /proc/partitions | tr -s ' ' | sed '1,2 d'`
RootDiskFreeFrugal=`df | grep -w '/' | grep 'rootfs'`
[ "$PUPMODE" = 12 ] && MountFrugal=`mount | grep '/initrd/mnt/dev_save' | cut -f 1 -d ' '`
RootDiskReadlinkDevRoot=`readlink /dev/root`
RootDiskFreeFullInstall=`df | grep -w '/' | tr -s ' ' | cut -f 1 -d ' '`
MountFull=`mount | grep -w '/' | grep '/dev/' | tr -s ' ' | cut -f 1 -d ' '`
BBrdev=`busybox rdev`

if test -n "$RootDiskFreeFrugal" -a -n "$MountFrugal" -a -z "$BBrdev" ; then ## frugal install
SimpleDeviceName=`echo $MountFrugal | sed 's#/dev/##'`
MainDriveName=${SimpleDeviceName:0:3}
RootDevice=`echo "$CatProcPart" | grep -w $SimpleDeviceName`
MainDevice=`echo "$CatProcPart" | grep -w $MainDriveName`
else
if test -n "$RootDiskFreeFullInstall" -a -n "$MountFull" -a -n "$BBrdev" ; then ## full install
SimpleDeviceName=`echo $MountFull | sed 's#/dev/##'`
MainDriveName=${SimpleDeviceName:0:3}

RootDevice=`echo "$CatProcPart" | grep -w $SimpleDeviceName`
if [ -z "$RootDevice" ] ; then  ###KRG&& SimpleDeviceName=`basename "$(busybox rdev)" | tr -d '/'`
SimpleDeviceName=`basename "$(busybox rdev | sed 's#/$## ; s#[[:blank:]]*$##')" | tr -d '/'`
RootDevice=`echo "$CatProcPart" | grep -w $SimpleDeviceName`
fi

MainDevice=`echo "$CatProcPart" | grep -w $MainDriveName`
if [ -z "$MainDevice" ] ; then
MainDriveName=`basename "$(busybox rdev | sed 's#/$## ; s#[[:blank:]]*$##')" | tr -d '/' | cut -b 1-3`
MainDevice=`echo "$CatProcPart" | grep -w $MainDriveName`
fi

fi

fi
};check_frugal_full_func

load_average '1x1a'
#file_system_state 7

mk_missing_var_dev_func() {

if test -d /var/db/$KERNVER/dev ; then
cp -a /var/db/$KERNVER/dev / 2>/dev/null

else
if test -f /var/db/boot/dev_nodes.lst; then
DDB="`cat /var/db/boot/dev_nodes.lst`"
cat /var/db/boot/dev_nodes.lst| while read PERM N O G MAY Min M D T DEV; do
[ -z "$DEV" ] && DEV=$T
KIND=${PERM:0:1}
MAJ=`echo $MAY | tr -d ','`
DN=`dirname $DEV`
[ -d $DN ] || mkdir $DN
[ -$KIND $DEV ] || { echo "making $DEV";mknod $DEV $KIND $MAJ $Min; }
done
fi
fi
}
mk_missing_var_dev_func
load_average '1x1b'
#file_system_state 8

} #MY_ADDITIONAL_PART
##MULTI-CORE +++2012-05-08
echo `date`
PROCESSORS=`grep ^processor /proc/cpuinfo |wc -l`
[ "$PROCESSORS" -gt '1' ] && { echo "'$PROCESSORS' processors detected";M_CORE=$PROCESSORS; }
if [ "$M_CORE" ];then
echo "Forking MY_ADDITIONAL_PART"
MY_ADDITIONAL_PART &
else
echo "Not forking MY_ADDITIONAL_PART"
MY_ADDITIONAL_PART
fi
echo `date`
##MULTI-CORE +++2012-05-08
load_average '1x00'
#file_system_state 9

pupstate_prev_func() {
if test "`grep -x KERNVER /etc/rc.d/PUPSTATE.prev | cut -f2 -d=`" != "$KERNVER" ; then
if test ! -f /lib/modules/$KERNVER/modules.dep -o ! -f /lib/modules/$KERNVER/modules.symbols -o ! -f /lib/modules/$KERNVER/modules.alias ; then
echo "Detected booting other kernel than last time" >> /dev/console
echo "Have to run depmod, please wait some 10 seconds" >> /dev/console
depmod
depmod-FULL
fi
fi
}; #pupstate_prev_func

#w469 may need to run 'depmod'...
#live-cd may have been built without the modules.* files.
#initrd init script copied modules to /lib/modules/<kernver>/initrd/.
if [ ! -f /lib/modules/${KERNVER}/modules.dep ];then
 NEEDDEPMOD="yes" #w469 files may not be there to save space.
 [ -d /lib/modules/${KERNVER}/initrd ] && NEEDGUNZIP="yes"
else
 if [ -d /lib/modules/${KERNVER}/initrd ];then
  if [ "`grep '/initrd/' /lib/modules/${KERNVER}/modules.dep`" = "" ];then
   NEEDDEPMOD="yes" #w469 files may not be there to save space.
   NEEDGUNZIP="yes"
  fi
 fi
fi
if [ "$NEEDGUNZIP" = "yes" ];then
 #w001 ubuntu module-init-tools not configured to support gzipped modules...
 #for ONEMOD in `find /lib/modules/${KERNVER}/initrd/* -type f -name *.gz | tr '\n' ' '`
 #do
 # gunzip $ONEMOD
 #done
 gunzip -f -r /lib/modules/${KERNVER}/initrd #w482 shinobar.
fi

#w481 now building with busybox depmod, in module-init-tools have depmod-FULL, so comment out...
##w481 workaround for crappy depmod. First boot 64MB ram no swap, only 14660 free ram, due to
##tmpfs top layer (about 26MB). depmod gives 'out of memory'. so delay until after swap loaded...

if [ "$NEEDDEPMOD" = "yes" ];then
 echo -n ' depmod' >/dev/console
 depmod
fi

[ $layerfs ] && LAYERFS=$layerfs #boot param.
[ $LAYERFS ] || LAYERFS=aufs #aufs or unionfs
[ "`modinfo aufs 2>/dev/null`" ] || LAYERFS=unionfs #precaution.

status_func $STATUS
load_average '1xff'
#file_system_state 13
#######################VERSION UPDATE##########################
echo "VERSION UPDATE"
#force update when new version of ${DISTRO_NAME}...
echo -n "Updating..." >/dev/console

/etc/rc.d/rc.update $PUPMODE
sync
status_func $STATUS
load_average '2xff'
#file_system_state 14
#################LOAD KERNEL MODULES################
echo "LOAD KERNEL MODULES"
. /etc/rc.d/MODULESCONFIG
echo `date`
#alias modprobe='modprobe -s' #-s regular modprobe+bb_v1.17 ;-L my modprobe
echo -n "Loading kernel modules..." >/dev/console

MODALIASES="`ls /sys/bus/*/devices/*/modalias`"

BLACKLISTVARS="`echo "$SKIPLIST" | tr '\-' '_' | tr ' ' '\n' | sed -e 's/^/blacklist /' | grep -v ' $'`"
echo "$BLACKLISTVARS" > /tmp/pup_event_modprobe.conf
echo "$BLACKLISTVARS" > /tmp/pup_event_skiplist.conf
[ -f /etc/modprobe.conf ] && cat /etc/modprobe.conf >> /tmp/pup_event_modprobe.conf
if [ -d /etc/modprobe.d ] ; then
for i in /etc/modprobe.d/* ; do
cat $i >> /tmp/pup_event_modprobe.conf
done
fi

#...read in /sbin/pup_event_backend_d, and pup_event_backend_modprobe (for udevd).

#if [ ! -d /initrd ];then #v423 full hd install.
if [ "`rdev`" ];then
 #v423 have this in 'init', probably need here too...
 if [ "`echo "$MODALIASES" | grep 'bc0Csc03i10'`" != "" ];then
  modprobe --config /tmp/pup_event_modprobe.conf yenta-socket
  [ $? -eq 0 ] && sleep 2
 fi
 #v423 k2.6.29.6 dmesg has warning that ehci-hcd should load before uhci-hcd and ohci-hid
 # this is contrary to my understanding all these years, but oh well, let's do it...
 ELSPCI="`elspci -l`" #jesses great little utility.
 [ "`echo "$ELSPCI" | grep '0C0320'`" != "" ] && modprobe --config /tmp/pup_event_modprobe.conf ehci-hcd
 #...perhaps a udev rule could have done this?
 [ "`echo "$ELSPCI" | grep '0C0310'`" != "" ] && modprobe --config /tmp/pup_event_modprobe.conf ohci-hcd
 [ "`echo "$ELSPCI" | grep '0C0300'`" != "" ] && modprobe --config /tmp/pup_event_modprobe.conf uhci-hcd
fi
[ -n "`lsmod | grep -E 'uhci|ohci|ehci'`" ] && modprobe usbhid

#v405 udevd calls /sbin/pup_event_backend_modprobe, which needs this...#my intention is for puppy to work with either of these...
if [ -x /sbin/udevd ];then  ##2011_10_27 changed -f to -x
 [ "$LOGLEVEL" ] || LOGLEVEL=7
[ -z "`pidof udevd`" ] && UDEV_LOG=$LOGLEVEL /sbin/udevd --daemon
else
[ -z "`pidof pup_event_backend_d`" ] &&  pup_event_backend_d >/tmp/pup_event_backend_errors 2>&1 & #hotplug daemon. my homebrew replacement for udevd.
fi
sleep 0.1

INITSTATE=`find /sys -name "initstate"`
INITSTATEwc_l=`echo "$INITSTATE" | wc -l`
echo 'INITSTATEwc_l='"$INITSTATEwc_l"
load_average '3x0a'
if [ -z "$MODALIASES" ] ; then #1

echo -e "\e[1;5;31m"'WARNING : '"\e[0;31m"'No modaliases found !'"\e[39m" >/dev/console
echo -e "\e[39m"'Either the kernel detected no HW automatically'"\e[39m" >/dev/console
echo -e "\e[39m"'or something else went wrong'"\e[39m" >/dev/console

else #1

[ -f /tmp/pup_event_alsa_cnt ] || echo -n '0' > /tmp/pup_event_alsa_cnt

if [ "$INITSTATEwc_l" -lt 25 ] ; then  #initrd.gz loads 10 modules plus some extra #2
echo 'Running the modaliases add by rc.sysinit '$0
echo >> /tmp/pup_event_module_devpath_log
echo 'Running the modaliases add by rc.sysinit '$0 >> /tmp/pup_event_module_devpath_log

MODULECNT=0
#replay uevents from /sys...
for ONEMODALIAS in $MODALIASES
do
 ONEPATH="`dirname $ONEMODALIAS`"
 if [ -e ${ONEPATH}/uevent ];then
  echo 'added '"${ONEPATH}" >> /tmp/bootmodules.txt
  echo add > ${ONEPATH}/uevent #generates an 'add' uevent.
  sleep 0.02
  #echo -n '.' >/dev/console
  echo -ne "\r$MODULECNT" >/dev/console
  MODULECNT=$((MODULECNT+1))
 fi
done
echo >> /tmp/bootmodules.txt

else #2
echo 'Skipping uevent part , more than 25 modules already loaded ...'

fi
fi

load_average '3x0b'
#if [ ! -d /initrd ];then #full hd installation.
if [ "`rdev`" ];then
 modprobe nls_cp437 #these needed by vfat/ntfs/ext2 f.s.'s.
 modprobe nls_iso8859-1 # "
 modprobe fuse
 modprobe $LAYERFS #unionfs or aufs.
 modprobe squashfs
 #we can determine ide/sata drives at this point (drivers builtin to kernel)...
 #ATADRIVES="`ls -1 /sys/block | grep '^sd' | tr '\n' ' '`"
 #ATADRIVES="`cat /proc/partitions | grep "sd[a-z]$" | tr -s " " | cut -f 5 -d " " | tr "\n" " "`"
 SATADRIVES="`ls -1 /sys/block | grep '^sd' | tr '\n' ' '`"
 for i in $SATADRIVES; do
 LinkTarget=`readlink -f /sys/block/$i`
 if test "`echo $LinkTarget | grep 'usb'`" != ""; then
 USB_SATAD="$USB_SATAD $i"
 else
 BLOCK_SATAD="$BLOCK_SATAD $i"
 fi
 done
 if [ -e /proc/ide ];then
  echo "SATADRIVES='${BLOCK_SATAD}'" >> /etc/rc.d/PUPSTATE #kernel supports /dev/hd*.
 else
  echo "ATADRIVES='${BLOCK_SATAD}'" >> /etc/rc.d/PUPSTATE
 fi
 echo "USB_SATAD='${USB_SATAD}'" >> /etc/rc.d/PUPSTATE
fi

if [ -z "`lsmod | grep 'usb_storage'`" ]; then
modprobe usb_storage
fi

[ -d /proc/acpi ] || modprobe apm #v406

status_func 0
load_average '3xff'
#file_system_state 15
######################LOAD SWAP#####################
[ "$SWAPON" != "yes" ] && loadswap_func

file_system_state 16
#################MISC. SYSTEM SETUP#################
echo "MISC. SYSTEM SETUP"
syslogd -m 0
klogd
syslogd -O /var/log/syslog.7 -l 7 -s 1024 -b 99

echo -e "${DISTRO_NAME} Linux\n`uname -s` `uname -r` [`uname -m` arch]\n\n" > /etc/issue
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
hostname -F /etc/hostname

rm -f /mnt/home
#if [ ! -d /initrd ];then
if [ "`rdev`" ];then
 PUP_HOME='/'
 echo "PUP_HOME='/'" >> /etc/rc.d/PUPSTATE
 ln -s / /mnt/home
else
 if [ "$PUP_HOME" ];then #see /etc/rc.d/PUPSTATE
  if [ "$PUP_HOME" = "/pup_ro1" -o "$PUP_HOME" = "/pup_rw" ];then
   #note, PUPMODE=6 will have PUP_HOME=/pup_rw.
   #in the case of the persistent storage being the partition itself, this will be mounted
   #on /initrd/pup_ro1 (tmpfs on pup_rw for restricted writes) or directly on /initrd/pup_rw
   #and we do not really want users to access it as it is a unionfs layer. Instead, they are
   #already accessing it as "/".
   ln -s / /mnt/home
  else
   ln -s /initrd${PUP_HOME} /mnt/home
  fi
 fi
fi
load_average '4xff'
#file_system_state 17
################WAIT MODULES LOADED##################
echo "WAIT MODULES LOADED"
#previous module loading may not have completed...
echo -n "Waiting for modules to complete loading..." >/dev/console
WAITCNT=0
PCIPCMCIA="`elspci -l | grep -o '060700'`"
PCIUSB="`elspci -l | grep -o -E '0C0300|0C0310|0C0320'`"
if [ "$PCIPCMCIA" != "" ];then #this may be slow to respond.
 echo -n " pcmcia"  >/dev/console
 while [ $WAITCNT -lt 10 ];do
  [ "`lsmod | grep -E '^yenta_socket |^tcic |^i82092 |^i82365 |^pd6729 '`" != "" ] && break
  WAITCNT=`expr $WAITCNT + 1`
  sleep 1
  echo -n " $WAITCNT" >/dev/console
 done
fi
#note, if initrd then usb-storage will have already loaded...
if [ "$PCIUSB" != "" ];then #this may be slow to respond.
 echo -n " usb"  >/dev/console
 PCIUSBNUM=`echo "$PCIUSB" | sort -u | wc -l`
 while [ $WAITCNT -lt 10 ];do
  [ `lsmod | grep -o -E '^uhci_hcd|^ohci_hcd|^ehci_hcd' | wc -l` -ge $PCIUSBNUM ] && break
  WAITCNT=`expr $WAITCNT + 1`
  sleep 1
  echo -n " $WAITCNT" >/dev/console
 done
fi

#replay uevents from /sys (more interfaces as a consequence of above drivers loaded)...
#note, this also a workaround for kernel 'bug' where entries appear in /sys but no uevent
#gets generated (yes it happens in 2.6.25.x kernel!)

if [ $KERNMAJ -lt 24 ];then #v431
 [ -e /sys/bus/pcmcia/devices ] && NEWPCMCIA="`ls /sys/bus/pcmcia/devices/*/modalias | tr '\n' ' '`"
 [ -e /sys/bus/usb/devices ] && NEWUSB="`ls /sys/bus/usb/devices/*/modalias | tr '\n' ' '`"
 echo KERNELMAJ=$KERNMAJ >> /tmp/bootmodules.txt
 for ONEMODALIAS in ${NEWPCMCIA}${NEWUSB}
 do
  ONEPATH="`dirname $ONEMODALIAS`"
  if [ -e ${ONEPATH}/uevent ];then
   echo 'added '"${ONEPATH}" >> /tmp/bootmodules.txt
   echo add > ${ONEPATH}/uevent #generates an 'add' uevent.
   sleep 0.02
  fi
 done
else
echo KERNELMAJ=$KERNMAJ >> /tmp/bootmodules.txt
 #v424 try it a different way, this also fixes ssb devices (such as b43.ko)...
 [ -e /sys/bus/pcmcia/devices ] && NEWPCMCIA="`ls /sys/bus/pcmcia/devices/*/uevent 2>/dev/null | tr '\n' ' '`"
 [ -e /sys/bus/usb/devices ] && NEWUSB="`ls /sys/bus/usb/devices/*/uevent 2>/dev/null | tr '\n' ' '`"
 [ -e /sys/bus/ssb/devices ] && NEWSSB="`ls /sys/bus/ssb/devices/*/uevent 2>/dev/null | tr '\n' ' '`"
 for ONEUEVENT in ${NEWPCMCIA}${NEWUSB}${NEWSSB}
 do
  ONEPATH="`dirname $ONEUEVENT`"
  #the check for 'modalias' file is maybe needed for old kernel?...
  [ ! -e ${ONEPATH}/modalias ] && [ "`grep 'MODALIAS' $ONEUEVENT`" = "" ] && continue
  echo 'added '"${ONEUEVENT}" >> /tmp/bootmodules.txt
  echo add > $ONEUEVENT
  sleep 0.02
 done
fi

#wait for usb-storage drives to become available...(already done if initrd)
#note, pup_event_backend_d and udevd both log to this file when load modules
# (the latter via udev handler script /sbin/pup_event_backend_modprobe)...
if [ "`grep 'usb_storage' /tmp/pup_event_module_devpath_log`" != "" ];then #see pup_event_backend_d
 echo -n " usb-storage"  >/dev/console
 while [ $WAITCNT -lt 15 ];do
  [ "`dmesg | grep 'usb-storage: device scan complete'`" != "" ] && break
  sleep 1
  WAITCNT=`expr $WAITCNT + 1`
  echo -n " $WAITCNT" >/dev/console
 done
 #precaution, make sure have got them all... v412 need sort -u...
 USBSTORAGES=`/bin/dmesg | grep "usb-storage: device found at" | sort -u | wc -l`
 while [ $WAITCNT -lt 15 ];do
  AVAILABLEUSBSTORAGES=`/bin/dmesg | grep "usb-storage: device scan complete" | wc -l`
  [ $AVAILABLEUSBSTORAGES -ge $USBSTORAGES ] && break
  sleep 1
  WAITCNT=`expr $WAITCNT + 1`
  echo -n " $WAITCNT" >/dev/console
 done
fi

sleep 1 #v411 a bit extra. rerwin reports usb mouse detection problem some hardware.
        #(delay before usb mouse info appears in /proc/bus/input/devices)

status_func 0
load_average '5xff'
#file_system_state 18
##############USER SELECTED MODULES##################
echo "USER SELECTED MODULES"
#the user can select extra modules to load in the BootManager...
if [ "$ADDLIST" != "" ];then #variable is in /etc/rc.d/MODULESCONFIG
 echo -n "Loading user-selected modules..." >/dev/console
 for MODULE in $ADDLIST
 do
  MPARAMS=""
  if [ `echo -n "$MODULE" | tr ':' ' ' | wc -w` -gt 1 ];then
   MPARAMS="`echo -n "$MODULE" | cut -f 2-9 -d ':' | tr ':' ' '`"
   MODULE="`echo -n "$MODULE" | cut -f 1 -d ':'`"
  fi
  MODULE=`echo "$MODULE" | tr '-' '_'`
  echo -n " $MODULE" >/dev/console
  echo "Loading module $MODULE $MPARAMS"
  firmware_module_func #install firmware tarball. see functions4puppy4.
  #w463 for mwave.ko (modem), do not load module, just the firmware, which has script that correctly loads mwave.ko.
  #if [ -z "`lsmod | grep "$MODULE"`" ] ; then
  [ "$MODULE" != "mwave" ] && modprobe $MODULE $MPARAMS
  #fi
 done
 status_func 0
fi

fbcon_func() {
if [ -n "`modprobe -l | grep 'fbcon'`" ]; then
if [ "`cat /proc/cmdline | grep -E 'vga=ask|vga=0x3[0-9a-fA-F][0-9a-fA-F]|vga=[7-8][0-9][0-9]'`" != "" ]; then
if [ ! "`grep 'fbcon' /tmp/pup_event_modprobe.conf |grep -vEe '^#|^[[:blank:]]*#' |tail -n1 |grep 'blacklist'`" ];then
if [ ! "$NO_FBCON" ];then
echo >> /dev/console
modinfo fbcon > /dev/console
sleep 1
modprobe fbcon
fi;fi;fi ##+++2012-01-11 added check for blacklisting above
fi
}
fbcon_func
load_average '6xff'
##file_system_state 19
###################SETUP SERVICES################
echo "SETUP SERVICES"
echo -n "Setting up services (network, printing, etc.)..." >/dev/console
if [ -h /dev/modem ];then
 DEVM="`readlink /dev/modem`"
 case $DEVM in
  modem) #error, circular link.
   rm -f /dev/modem
   DEVM=""
  ;;
  /dev/*) #wrong format.
   DEVM="`echo -n "$DEVM" | cut -f 3,4 -d '/'`"
   ln -snf $DEVM /dev/modem
  ;;
 esac
 case $DEVM in
  ttyS[0-9]) #apparently setserial can crash with other modems.
   setserial -v -b /dev/modem auto_irq skip_test autoconfig
  ;;
 esac
fi

#had hoped to retire this, but HardInfo needs it...
[ "`lsmod | grep '^usbcore'`" != "" ] && busybox mount -t usbfs none /proc/bus/usb

#v408 only needed for 2.6.21.7, as 2.6.25.x loads these automatically...
#v408 kirk: Check for laptop battery...
modprobe battery
#if [ -d /proc/acpi/battery ]; then
 results="`find /proc/acpi/battery -mindepth 1 -type d`"
# if [ ! -z "$results" ]; then
  modprobe ac
#  modprobe thermal
  modprobe fan
# else
#  rmmod battery
# fi
#fi

#v411 can use old network wizard (from 403, based on 400)...
CHECKOLDWIZ="`ls -1 /etc/*[0-9]mode 2>/dev/null`" #ex: eth0mode, wlan0mode.
if [ "$CHECKOLDWIZ" != "" -a -d /usr/local/net_setup ];then
 #note, old wizard is located in /usr/local/net_setup.
 /usr/local/net_setup/etc/rc.d/rc.network &
else
 /etc/rc.d/rc.network &
fi

/etc/rc.d/rc.services & #run scripts in /etc/rc.d/init.d

echo -e "\\033[62G\\033[1;33m[backgrounded]\\033[0;39m" >/dev/console #column 62, yellow.
load_average '7xff'
#file_system_state 20
############RECOGNISE MEDIA DEVICES################
echo "RECOGNISE MEDIA DEVICES"
echo -n "Recognising media devices..." >/dev/console
#recognise optical drives...
echo -n ' optical' >/dev/console
OPTCNT=1;CDTYPE="";DVDTYPE="";CDBURNERTYPE=""
OPTICALS="`grep '^drive name:' /proc/sys/dev/cdrom/info | grep -o -E 'sr.*|hd.*' | tr '\t' ' '`"
[ -L /dev/cdrom ] && CDTYPE="`readlink /dev/cdrom | cut -f 3 -d '/'`"
[ -L /dev/dvd ] && DVDTYPE="`readlink /dev/dvd | cut -f 3 -d '/'`"
[ -f /etc/cdburnerdevice ] && CDBURNERTYPE="`cat /etc/cdburnerdevice`"
[ "`echo "$OPTICALS" | grep "$CDTYPE"`" = "" ] && CDTYPE="" #no longer exists.
[ "`echo "$OPTICALS" | grep "$DVDTYPE"`" = "" ] && DVDTYPE="" #no longer exists.
[ "`echo "$OPTICALS" | grep "$CDBURNERTYPE"`" = "" ] && CDBURNERTYPE="" #no longer exists.
for ONEOPTICAL in $OPTICALS
do
 ONENUM="`echo -n "$ONEOPTICAL" | cut -c 3`"
 [ "$CDTYPE" = "" ] && CDTYPE="$ONEOPTICAL"
 [ "$DVDTYPE" = "" ] && [ "`grep '^Can read DVD' /proc/sys/dev/cdrom/info | head -n 1 | grep -o '[01]' | sed -e 's/[^01]//g' | cut -c $OPTCNT`" = "1" ] && DVDTYPE="$ONEOPTICAL"
 [ "$CDBURNERTYPE" = "" ] && [ "`grep '^Can write CD' /proc/sys/dev/cdrom/info | head -n 1 | grep -o '[01]' | sed -e 's/[^01]//g' | cut -c $OPTCNT`" = "1" ] && CDBURNERTYPE="$ONEOPTICAL"
 OPTCNT=`expr $OPTCNT + 1`
done
rm -f /dev/cdrom; rm -f /dev/dvd; rm -f /etc/cdburnerdevice
[ "$CDTYPE" ] && ln -sf /dev/$CDTYPE /dev/cdrom
[ "$DVDTYPE" ] && ln -sf /dev/$DVDTYPE /dev/dvd
[ "$CDBURNERTYPE" ] && echo -n "$CDBURNERTYPE" > /etc/cdburnerdevice
[ "$DVDTYPE" ] && hdparm -d1 /dev/$DVDTYPE >/dev/null 2>&1

#w468 simplify...
##w463 i think time has come to dump the old 'psaux'. use /dev/input/mice for both usb
##and ps/2 mice...
##recognise mouse... v411...
##note, if wanted to detect serial mouse here, k2.6.25.16 has module 'sermouse' that must be loaded (currently in xwin).

#TODO: simplify above, use 'input/mice' for ps2 mouse also, but may need to modify Xorg/Xvesa/Input Wizards.
#      (may also have to remove builtin psaux driver from kernel).
if [ -f /etc/mousedevice ];then
 [ "`cat /etc/mousedevice`" = "psaux" ] && echo -n "input/mice" > /etc/mousedevice
else
 echo -n "input/mice" > /etc/mousedevice
 ln -snf input/mice /dev/mouse
fi

#recognise keyboard...
#echo -n ' keyboard' >/dev/console
/etc/rc.d/rc.country ;STATUS=$(( $STATUS + $? )) #this asks for keyboard layout.

status_func $STATUS
load_average '8xff'
#file_system_state 21
############MISC DESKTOP STUFF##################
echo "MISC. DESKTOP STUFF"
if [ "$PUPMODE" = "77" ];then #77=multisession cd/dvd.
 if [ "`cat /root/Choices/ROX-Filer/PuppyPin | grep "savesession"`" = "" ];then
  echo '<icon x="768" y="128" label="save">/usr/sbin/savesession-dvd</icon>' >> /root/Choices/ROX-Filer/PuppyPin
  cat /root/Choices/ROX-Filer/PuppyPin | grep -v '/pinboard' > /tmp/PuppyPin-CPY
  sync
  cp -f /tmp/PuppyPin-CPY /root/Choices/ROX-Filer/PuppyPin
  echo '</pinboard>' >> /root/Choices/ROX-Filer/PuppyPin
 fi
fi

#save button on desktop when booted from flash drive...
if [ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ];then #pup_rw is tmpfs. frugal flash to part internal, *external, save-file external
 if [ "`cat /root/Choices/ROX-Filer/PuppyPin | grep "save2flash"`" = "" ];then
  echo '<icon x="768" y="128" label="save">/usr/sbin/save2flash</icon>' >> /root/Choices/ROX-Filer/PuppyPin
  cat /root/Choices/ROX-Filer/PuppyPin | grep -v '/pinboard' > /tmp/PuppyPin-CPY
  sync
  cp -f /tmp/PuppyPin-CPY /root/Choices/ROX-Filer/PuppyPin
  echo '</pinboard>' >> /root/Choices/ROX-Filer/PuppyPin
 fi
fi

#file_system_state 22
###################PERSONAL BOOT SCRIPT######################
echo "PERSONAL BOOT SCRIPT"
#personal boot script here...
if [ -f /etc/rc.d/rc.local ];then
 :
else
 echo '#this file called from rc.sysinit' > /etc/rc.d/rc.local
 echo '#you can edit this file' >> /etc/rc.d/rc.local
 echo '#When firewall is installed, will append lines to this file...' >> /etc/rc.d/rc.local
fi
. /etc/rc.d/rc.local
###################PERSONAL BOOT SCRIPT######################

dmesg > /tmp/bootkernel.log
load_average '9xff'
###NOX SUPPORT###
if [ ! -f /tmp/X.status ];then
#Xvesa does not work anymore ..?
if [ "`basename $(readlink -e $(which X))`" != "Xorg" ]; then ##+++2012-05-02 changed readlik -f to -e
echo 'nox' > /tmp/X.status
elif [ -n "`cat /proc/cmdline | grep -i 'nox'`" ]; then
echo 'nox' > /tmp/X.status
else
echo 'X' > /tmp/X.status
fi;fi
###NOX SUPPORT###

### FSCKME ###
if [[ $PUPMODE == 2 ]] ; then
RD=`basename $(rdev | cut -f 1 -d ' ') 2>/dev/null`
FS=`mount | grep '^/dev/root' | cut -f 5 -d ' '`
echo "$RD"','"$FS"',' > /etc/.fsckme.flg
echo "PDEV1='$RD'" >> /etc/rc.d/PUPSTATE
fi
### FSCKME ###

### MKNODs ###
[ -c /dev/ppp ] || mknod /dev/ppp c 108 0
[ -L /dev/mouse ] || ln -s /dev/input/mice /dev/mouse
[ -c /dev/mem ] || mknod /dev/mem c 1 1
[ -L /dev/modem ] || { MODEM=`dmesg | grep -i 'MODEM' |grep 'attached' |head -n1 |rev |awk '{print $1}' |rev`;[ "$MODEM" ] && ln -s $MODEM /dev/modem; }
### MKNODs ###

#file_system_state 23

### sort logs ###
pup_eve_bac_mod_func(){
FILE='/tmp/pup_eve_bac_mod.log'
[ -f "$FILE" ] || FILE='/tmp/pup_event_backend_modprobe.log'
while [ "`pidof rc.services`" -o "`pidof pup_event_backend_modprobe`" ];do sleep 2;done
sleep 5s  ## 120s ##5s
echo 'Sorting now this log file by '$0 >> $FILE
cat $FILE | sort -g -k 1,3 -t ' ' >$FILE.sorted
PIDS=`cat $FILE.sorted | cut -f 1 -d ' ' | sort -u | sort -g`
for i in $PIDS ; do
#echo PID  "$i"
Line=`grep -n -w "^$i" $FILE.sorted | tail -n 1 | cut -f 1 -d ':'`
#echo Line "$Line"
sed -i "$Line a\ " $FILE.sorted
done
}
pup_eve_bac_mod_func &
### sort logs ###

### capture bootscreen ###
[ -e /dev/vcs1 ] || { mknod /dev/vcs1 c 7 1;sleep 1; }
cat /dev/vcs1 >/tmp/vcs1.txt
echo -e "\n\n" >>/tmp/vcs1.txt
echo -e "`cat /tmp/vcs1.txt |sed -e 's,\(.\{80\}\),\1\\n,g'`" >>/tmp/vcs1.txt
### capture bootscreen ###

load_average 'FxFF'

#that's it. next stop is /etc/profile...
###END###

You mean dis ?
Back to top
View user's profile Send private message Visit poster's website 
espertalhao04

Joined: 11 May 2012
Posts: 70

PostPosted: Thu 21 Jun 2012, 22:05    Post subject:  

exactly, that is the script file...
if you read, from the end of the initial load of comments, you will see another comments saying what for is the script...
that is another script you might want to change, but be careful:
you don't do it on your own system file!!!
you can extract the content from the sfs file to a folder (click on the file, and it is mounted...
then you copy ALL the files from it to another place (it must be a ext* (2,3 or 4) partition)...
then you edit the file /etc/rc.d/rc.sysinit (the / is being count as the dir where you put all the files)...
use the command "dir2sfs" and then wait...
create a new iso, (using iso isomaster), with base of your original iso file, and save with A DIFFERENT NAME!
then you get qemu-puppy, and edit the puppy.sh file, to be runned using the new iso file...
open the script and you have in there a way to test it without reboot...
any questions, just ask...

_________________
asus a6000: intel m 1.6ghz, 2gb ram ddr, no hdd, usb 2.0 pendrive running puppy linux 4.3.1
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 3 [40 Posts]   Goto page: Previous 1, 2, 3
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2181s ][ Queries: 13 (0.0046s) ][ GZIP on ]