Bashpromt erweitert und FTP Upload wieder funktionierend gemacht...

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@397 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-01-25 19:04:11 +00:00
parent 0b59f25c65
commit 71e323840b
16 changed files with 191 additions and 61 deletions

32
config/etc/bashrc Normal file
View File

@@ -0,0 +1,32 @@
# Begin /etc/bashrc
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
# 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

View File

@@ -1,49 +1,64 @@
# /etc/bashrc
# Begin /etc/profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg>
umask 022
unset i
# System wide environment variables and startup programs.
# 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`
# 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.
# 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"
}
pathprepend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
}
pathappend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
}
# Set the initial path
export PATH=/bin:/usr/bin
if [ $EUID -eq 0 ] ; then
pathappend /sbin:/usr/sbin
unset HISTFILE
fi
# Setup some environment variables.
export HISTSIZE=1000
export HISTIGNORE="&:[bf]g:exit"
#export PS1="[\u@\h \w]\\$ "
export PS1='\u@\h:\w\$ '
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
fi
fi
fi
done
# Path manipulation
PATH="/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin"
# Now to clean up
unset pathremove pathprepend pathappend
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER=`id -un`
LOGNAME=$USER
HOSTNAME=`/bin/hostname`
HISTSIZE=250
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME HOSTNAME HISTSIZE INPUTRC
# LS Colors
alias dir='ls'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
# 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'
export LANG PS1
export TERM=linux
export COLORTERM=1
# End /etc/profile

View File

@@ -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'

View File

@@ -0,0 +1,2 @@
PROMPT_COMMAND='echo -ne "\e[1m${USER}@${HOSTNAME} : ${PWD}\e[0m\a"'
export PROMPT_COMMAND

View File

@@ -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

View File

@@ -0,0 +1,5 @@
# Setup the INPUTRC environment variable.
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
INPUTRC=/etc/inputrc
fi
export INPUTRC

View File

@@ -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

View File

@@ -22,6 +22,7 @@ bin/sync
bin/true
#bin/uname
bin/uname.bak
etc/dircolors
usr/bin/[
usr/bin/basename
#usr/bin/cksum

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 \

23
make.sh
View File

@@ -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)

View File

@@ -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

View File

@@ -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