From: ms Date: Thu, 25 Jan 2007 19:04:11 +0000 (+0000) Subject: Bashpromt erweitert und FTP Upload wieder funktionierend gemacht... X-Git-Tag: v2.3-beta1~857 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=71e323840bc1da5dbaa3203b0e7051fea8f9b10f Bashpromt erweitert und FTP Upload wieder funktionierend gemacht... git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@397 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/etc/bashrc b/config/etc/bashrc new file mode 100644 index 0000000000..e54dc861c2 --- /dev/null +++ b/config/etc/bashrc @@ -0,0 +1,32 @@ +# Begin /etc/bashrc +# Written for Beyond Linux From Scratch +# by James Robertson +# updated by Bruce Dubbs + +# Make sure that the terminal is set up properly for each shell + +if [ -f /etc/profile.d/tinker-term.sh ]; then + source /etc/profile.d/tinker-term.sh +fi + +# System wide aliases and functions. + +# System wide environment variables and startup programs should go into +# /etc/profile. Personal environment variables and startup programs +# should go into ~/.bash_profile. Personal aliases and functions should +# go into ~/.bashrc + +# Provides a colored /bin/ls command. Used in conjunction with code in +# /etc/profile. + +alias ls='ls --color=auto' + +# Provides prompt for non-login shells, specifically shells started +# in the X environment. [Review the LFS archive thread titled +# PS1 Environment Variable for a great case study behind this script +# addendum.] + +#export PS1="[\u@\h \w]\\$ " +export PS1='\u@\h:\w\$ ' + +# End /etc/bashrc diff --git a/config/etc/profile b/config/etc/profile index 6804fc42fc..49e8678c59 100644 --- a/config/etc/profile +++ b/config/etc/profile @@ -1,49 +1,64 @@ -# /etc/bashrc - -umask 022 -unset i - -# are we an interactive shell? -if [ "$PS1" ]; then - if [ -x /usr/bin/tput ]; then - if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal - stty erase `tput kbs` - elif [ -x /usr/bin/wc ]; then - if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal - stty erase `tput kbs` - fi - fi - fi -fi +# Begin /etc/profile +# Written for Beyond Linux From Scratch +# by James Robertson +# modifications by Dagmar d'Surreal + +# System wide environment variables and startup programs. -# Path manipulation -PATH="/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin" +# System wide aliases and functions should go in /etc/bashrc. Personal +# environment variables and startup programs should go into +# ~/.bash_profile. Personal aliases and functions should go into +# ~/.bashrc. -# No core files by default -ulimit -S -c 0 > /dev/null 2>&1 +# Functions to help us manage paths. Second argument is the name of the +# path variable to be modified (default: PATH) +pathremove () { + local IFS=':' + local NEWPATH + local DIR + local PATHVARIABLE=${2:-PATH} + for DIR in ${!PATHVARIABLE} ; do + if [ "$DIR" != "$1" ] ; then + NEWPATH=${NEWPATH:+$NEWPATH:}$DIR + fi + done + export $PATHVARIABLE="$NEWPATH" +} -USER=`id -un` -LOGNAME=$USER +pathprepend () { + pathremove $1 $2 + local PATHVARIABLE=${2:-PATH} + export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" +} -HOSTNAME=`/bin/hostname` -HISTSIZE=250 +pathappend () { + pathremove $1 $2 + local PATHVARIABLE=${2:-PATH} + export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" +} -if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then - INPUTRC=/etc/inputrc + +# Set the initial path +export PATH=/bin:/usr/bin + +if [ $EUID -eq 0 ] ; then + pathappend /sbin:/usr/sbin + unset HISTFILE fi -export PATH USER LOGNAME HOSTNAME HISTSIZE INPUTRC +# Setup some environment variables. +export HISTSIZE=1000 +export HISTIGNORE="&:[bf]g:exit" +#export PS1="[\u@\h \w]\\$ " +export PS1='\u@\h:\w\$ ' -# LS Colors -alias dir='ls' -alias ll='ls -l --color=tty' -alias ls='ls --color=tty' +for script in /etc/profile.d/*.sh ; do + if [ -r $script ] ; then + . $script + fi +done -# IPFire language settings -LANG=en_US.utf8 -PS1='\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[1;31m\]\w \[\033[1;36m\]\$ \[\033[0m\]' -echo -n -e '\033%G' +# Now to clean up +unset pathremove pathprepend pathappend -export LANG PS1 -export TERM=linux -export COLORTERM=1 +# End /etc/profile diff --git a/config/profile.d/dircolors.sh b/config/profile.d/dircolors.sh new file mode 100644 index 0000000000..873d91b9b4 --- /dev/null +++ b/config/profile.d/dircolors.sh @@ -0,0 +1,9 @@ +# Setup for /bin/ls to support color, the alias is in /etc/bashrc. +if [ -f "/etc/dircolors" ] ; then + eval $(dircolors -b /etc/dircolors) + + if [ -f "$HOME/.dircolors" ] ; then + eval $(dircolors -b $HOME/.dircolors) + fi +fi +alias ls='ls --color=auto' diff --git a/config/profile.d/extra-promt.sh b/config/profile.d/extra-promt.sh new file mode 100644 index 0000000000..bf877dc937 --- /dev/null +++ b/config/profile.d/extra-promt.sh @@ -0,0 +1,2 @@ +PROMPT_COMMAND='echo -ne "\e[1m${USER}@${HOSTNAME} : ${PWD}\e[0m\a"' +export PROMPT_COMMAND diff --git a/config/profile.d/extrapaths.sh b/config/profile.d/extrapaths.sh new file mode 100644 index 0000000000..bb8f720935 --- /dev/null +++ b/config/profile.d/extrapaths.sh @@ -0,0 +1,15 @@ +if [ -d /usr/local/bin ]; then + pathprepend /usr/local/bin +fi +if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then + pathprepend /usr/local/sbin +fi +for directory in $(find /opt/*/bin -type d 2>/dev/null); do + pathappend $directory +done +if [ -d ~/bin ]; then + pathprepend ~/bin +fi +#if [ $EUID -gt 99 ]; then +# pathappend . +#fi diff --git a/config/profile.d/readline.sh b/config/profile.d/readline.sh new file mode 100644 index 0000000000..816d7c1022 --- /dev/null +++ b/config/profile.d/readline.sh @@ -0,0 +1,5 @@ +# Setup the INPUTRC environment variable. +if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then + INPUTRC=/etc/inputrc +fi +export INPUTRC diff --git a/config/profile.d/umask.sh b/config/profile.d/umask.sh new file mode 100644 index 0000000000..9a3f8243dd --- /dev/null +++ b/config/profile.d/umask.sh @@ -0,0 +1,6 @@ +# By default we want the umask to get set. +if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then + umask 002 +else + umask 022 +fi diff --git a/config/rootfiles/common/coreutils b/config/rootfiles/common/coreutils index d66701c31a..bfd47de108 100644 --- a/config/rootfiles/common/coreutils +++ b/config/rootfiles/common/coreutils @@ -22,6 +22,7 @@ bin/sync bin/true #bin/uname bin/uname.bak +etc/dircolors usr/bin/[ usr/bin/basename #usr/bin/cksum diff --git a/config/rootfiles/common/initscripts b/config/rootfiles/common/initscripts index c0e7129e9d..52b00b4279 100644 --- a/config/rootfiles/common/initscripts +++ b/config/rootfiles/common/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/modules etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/network +etc/rc.d/init.d/random etc/rc.d/init.d/rc etc/rc.d/init.d/reboot etc/rc.d/init.d/red @@ -34,6 +35,7 @@ etc/rc.d/init.d/udev_retry etc/rc.d/rc0.d/K08fcron etc/rc.d/rc0.d/K28apache etc/rc.d/rc0.d/K30sshd +etc/rc.d/rc0.d/K45random etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K90sysklogd etc/rc.d/rc0.d/S60sendsignals @@ -44,6 +46,7 @@ etc/rc.d/rc0.d/S99halt #etc/rc.d/rc3.d etc/rc.d/rc3.d/S10sysklogd etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S25random etc/rc.d/rc3.d/S30sshd etc/rc.d/rc3.d/S32apache etc/rc.d/rc3.d/S40fcron @@ -51,6 +54,7 @@ etc/rc.d/rc3.d/S40fcron etc/rc.d/rc6.d/K08fcron etc/rc.d/rc6.d/K28apache etc/rc.d/rc6.d/K30sshd +etc/rc.d/rc6.d/K45random etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K90sysklogd etc/rc.d/rc6.d/S60sendsignals diff --git a/config/rootfiles/common/stage2 b/config/rootfiles/common/stage2 index d74a546238..a4b8914d23 100644 --- a/config/rootfiles/common/stage2 +++ b/config/rootfiles/common/stage2 @@ -6,6 +6,7 @@ bin/stty #boot dev/null dev/console +etc/bashrc etc/certparams etc/fstab etc/group @@ -23,6 +24,11 @@ etc/nsswitch.conf #etc/opt etc/passwd etc/profile +etc/profile.d/dircolors.sh +etc/profile.d/extra-promt.sh +etc/profile.d/extrapaths.sh +etc/profile.d/readline.sh +etc/profile.d/umask.sh etc/resolv.conf etc/securetty etc/sysctl.conf diff --git a/lfs/coreutils b/lfs/coreutils index 5c0284c7ed..db1eb15db1 100644 --- a/lfs/coreutils +++ b/lfs/coreutils @@ -109,6 +109,7 @@ ifeq "$(ROOT)" "" echo '#!/bin/bash' > /bin/uname echo '/bin/uname.bak $$* | sed 's/i.86/$(MACHINE)/g'' >> /bin/uname chmod 755 /bin/uname + dircolors -p > /etc/dircolors else rm /tools/bin/hostname mv -f /tools/bin/uname /tools/bin/uname.bak diff --git a/lfs/initscripts b/lfs/initscripts index 3d89d52021..570a181079 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -97,6 +97,9 @@ $(TARGET) : ln -sf ../init.d/network /etc/rc.d/rc0.d/K80network ln -sf ../init.d/network /etc/rc.d/rc3.d/S20network ln -sf ../init.d/network /etc/rc.d/rc6.d/K80network + ln -sf ../init.d/random /etc/rc.d/rc0.d/K45random + ln -sf ../init.d/random /etc/rc.d/rc3.d/S25random + ln -sf ../init.d/random /etc/rc.d/rc6.d/K45random ln -sf ../init.d/mountkernfs /etc/rc.d/rcsysinit.d/S00mountkernfs ln -sf ../init.d/modules /etc/rc.d/rcsysinit.d/S05modules diff --git a/lfs/stage2 b/lfs/stage2 index 623467c73b..49747d51aa 100644 --- a/lfs/stage2 +++ b/lfs/stage2 @@ -79,6 +79,11 @@ $(TARGET) : echo "===============================" >> /etc/issue echo "\n running on \s \r \m" >> /etc/issue + # Bash startup files + install --directory --mode=0755 --owner=root --group=root /etc/profile.d + for i in $(DIR_SRC)/config/profile.d/*; do \ + [ -f $$i ] && cp $$i /etc/profile.d; \ + done # Scripts for i in `find $(DIR_SRC)/src/scripts -maxdepth 1 -type f`; do \ diff --git a/make.sh b/make.sh index 4119f6e248..02d2a776e2 100644 --- a/make.sh +++ b/make.sh @@ -917,13 +917,13 @@ uploadsrc) PWD=`pwd` cd $BASEDIR/cache/ echo -e "Uploading cache to ftp server:" - ncftpls -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT ftp://$IPFIRE_FTP_URL_INT$IPFIRE_FTP_PATH_INT/ > /var/tmp/ftplist + ncftpls -u $FTP_CACHE_USER -p $FTP_CACHE_PASS ftp://$FTP_CACHE_URL$FTP_CACHE_PATH/ > /var/tmp/ftplist for i in *; do if [ "$i" == "toolchains" ]; then continue; fi grep -q $i /var/tmp/ftplist if [ "$?" -ne "0" ]; then echo -ne "$i" - ncftpput -bb -u $IPFIRE_FTP_USER_INT -p $IPFIRE_FTP_PASS_INT $IPFIRE_FTP_URL_INT $IPFIRE_FTP_PATH_INT/ $i >> $BASEDIR/log/_build.uploadsrc.log 2>&1 + ncftpput -u $FTP_CACHE_USER -p $FTP_CACHE_PASS $FTP_CACHE_URL $FTP_CACHE_PATH/ $i if [ "$?" -eq "0" ]; then beautify message DONE else @@ -932,15 +932,6 @@ uploadsrc) fi done rm -f /var/tmp/ftplist - UL_TIME_START=`date +'%s'` - ncftpbatch -d > /dev/null 2>&1 - while ps acx | grep -q ncftpbatch - do - UL_TIME=$(expr `date +'%s'` - $UL_TIME_START) - echo -ne "\r ${UL_TIME}s : Upload is running..." - sleep 1 - done - beautify message DONE cd $PWD exit 0 ;; @@ -956,10 +947,10 @@ EOF ncftp -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT < .ftp-commands rm -f .ftp-commands md5sum ipfire-install-$VERSION.i386.iso > ipfire-install-$VERSION.i386.iso.md5 - ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386.iso - ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-install-$VERSION.i386.iso.md5 - ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-source-r$SVN_REVISION.tar.gz - ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ svn_status + ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS $FTP_ISO_URL $FTP_ISO_PATH/ ipfire-install-$VERSION.i386.iso + ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS $FTP_ISO_URL $FTP_ISO_PATH/ ipfire-install-$VERSION.i386.iso.md5 + ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS $FTP_ISO_URL $FTP_ISO_PATH/ ipfire-source-r$SVN_REVISION.tar.gz + ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS $FTP_ISO_URL $FTP_ISO_PATH/ svn_status if [ "$?" -eq "0" ]; then echo -e "The iso of Revision $SVN_REVISION was successfully uploaded to $IPFIRE_FTP_URL_EXT$IPFIRE_FTP_PATH_EXT/." else @@ -967,7 +958,7 @@ EOF exit 1 fi if [ "$3" = "--with-sources-cd" ]; then - ncftpput -u $IPFIRE_FTP_USER_EXT -p $IPFIRE_FTP_PASS_EXT $IPFIRE_FTP_URL_EXT $IPFIRE_FTP_PATH_EXT/ ipfire-sources-cd-$VERSION.$MACHINE.iso + ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS $FTP_ISO_URL $FTP_ISO_PATH/ ipfire-sources-cd-$VERSION.$MACHINE.iso fi ;; paks) diff --git a/src/initscripts/init.d/random b/src/initscripts/init.d/random new file mode 100644 index 0000000000..26c64e3b34 --- /dev/null +++ b/src/initscripts/init.d/random @@ -0,0 +1,35 @@ +#!/bin/sh +# Begin $rc_base/init.d/random + +# Based on sysklogd script from LFS-3.1 and earlier. +# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org +# Random script elements by Larry Lawrence + +. /etc/sysconfig/rc +. $rc_functions + +case "$1" in + start) + boot_mesg "Initializing kernel random number generator..." + if [ -f /var/tmp/random-seed ]; then + /bin/cat /var/tmp/random-seed >/dev/urandom + fi + /bin/dd if=/dev/urandom of=/var/tmp/random-seed \ + count=1 &>/dev/null + evaluate_retval + ;; + + stop) + boot_mesg "Saving random seed..." + /bin/dd if=/dev/urandom of=/var/tmp/random-seed \ + count=1 &>/dev/null + evaluate_retval + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +# End $rc_base/init.d/random diff --git a/tools/make-functions b/tools/make-functions index c288f71c93..f3ce22007b 100644 --- a/tools/make-functions +++ b/tools/make-functions @@ -123,7 +123,7 @@ beautify() ;; build_end) BUILD_TIME_END=`date +%s` - echo -ne "${BOLD}***Build is finished now!\nThis took:\t\t\t $[ $BUILD_TIME_END - $BUILD_TIME_START ] (secs)${NORMAL}\n" + echo -ne "${DONE}***Build is finished now and took $[ $BUILD_TIME_END - $BUILD_TIME_START ] secs!${NORMAL}\n" ;; make_pkg) echo "$2" | while read PKG_VER PROGRAM OPTIONS