X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage2%2Fcreate-config-files;h=d1643ba85abe88c32e96fea4720d6fbcb7a563b5;hb=1b3f334af67c84997f7b5e6dee56faf556f0ea4b;hp=f0ca40ae8b850f38c44c61fceb1579a4833e0fe1;hpb=16cc35ba4890382ee9368a176e4f5a7fa773b7a6;p=hvlinux.git diff --git a/stage2/create-config-files b/stage2/create-config-files index f0ca40a..d1643ba 100755 --- a/stage2/create-config-files +++ b/stage2/create-config-files @@ -1,211 +1,13 @@ -#!/bin/sh +#!/bin/bash -# Reading system configuration informations, functions and package versions. -source ../sysinfos -source ../functions -source ../packages-list +source ../functions/main -CWD=$(pwd) +# Removing /tools from PATH: +SED_REP='/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin' +sed -i -e "s!^\(PATH=\).*tools.*!\1${SED_REP}!" /etc/profile -echo "Creating /etc/fstab" && -cat > /etc/fstab << "EOF" -# Device Mount point FS-type Options Dump Fsck-order -# ---------------------------------------------------------------------------- -EOF -evaluate_retval -if [ -n "${BOOT_PARTITION}" ]; then - echo "${BOOT_PARTITION} /boot ext2 defaults 1 1" >> /etc/fstab || exit 1 -fi -if [ -n "${SWAP_PARTITION}" ]; then - echo "${SWAP_PARTITION} none swap sw 0 0" >> /etc/fstab || exit 1 -fi -echo "${LFS_PARTITION} / reiserfs defaults,noatime 0 0" >> /etc/fstab && -echo "/dev/cdrom /media/cdrom auto ro,noauto,users 0 0" >> /etc/fstab && -echo "/dev/dvd /media/dvd auto ro,noauto,users 0 0" >> /etc/fstab && -echo "proc /proc proc defaults 0 0" >> /etc/fstab && -echo "sysfs /sys sysfs defaults 0 0" >> /etc/fstab && -echo "devpts /dev/pts devpts gid=4,mode=620 0 0" >> /etc/fstab && -echo "shm /dev/shm tmpfs defaults 0 0" >> /etc/fstab && -echo "none /proc/bus/usb usbfs defaults,devmode=0666 0 0" >> /etc/fstab && - -echo "Creating /etc/profile" && -cat > /etc/profile << "EOF" && -#!/bin/sh -# /etc/profile - -# System wide environment and startup programs -# Functions and aliases go in /etc/bashrc -# This is the first file read by bash during the logon process. - -export USER=`id -un` -export LOGNAME=$USER -export MAIL="/var/mail/$USER" -export HISTFILESIZE=1000 -export HISTSIZE=1000 -export HOSTNAME=`/bin/hostname` -export EDITOR=_DEFAULT_EDITOR_ -export CFLAGS="-pipe -O2" -export CXXFLAGS=${CFLAGS} - -# Set default permissions when creating new files. -if [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then - # Normal user - umask 002 -else - # Root - umask 022 -fi - -if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then - export INPUTRC=/etc/inputrc -fi - -# This disables generation of 'core' files when an application exit abnormally -ulimit -c 0 - -PATH="/bin:/usr/bin:/usr/local/bin" -if [ $USER = 'root' ]; then - PATH="/sbin:/usr/sbin:$PATH:/usr/local/sbin" -fi - -MANPATH="/usr/share/man:/usr/local/share/man" - -export PATH MANPATH PS1 PS2 - -export LANG="en_US.ISO8859-1" - -# The sort order of ls output is affected by the locale and -# can be overridden by the LC_COLLATE environment variable. -# For example, if LC_COLLATE equals C, dot files appear first, -# followed by names beginning with upper-case letters, then -# followed by names beginning with lower-case letters. But if -# LC_COLLATE equals en_US.ISO8859-1, then leading dots as well -# as case are ignored in determining the sort order. -export LC_COLLATE=C - -EOF - -sed -i -e "s!_DEFAULT_EDITOR_!${DEFAULT_EDITOR}!g" /etc/profile && - -var_add_str "CFLAGS" /etc/profile "-march=${MACHINE_ARCHITECTURE}" && - -echo "Creating /etc/bashrc" && -cat > /etc/bashrc << "EOF" && -#!/bin/sh - -# /etc/bashrc - -# System wide functions and aliases -# Environment stuff goes in /etc/profile - -alias df='df -h' -alias du='du -h -s' -# --show-control-chars is for seeing international characters in filenames -alias ls='ls -h --color=auto --show-control-chars' -alias halt='/sbin/halt' -alias reboot='/sbin/reboot' - -eval $(dircolors --sh /etc/DIR_COLORS) - -# For some unknown reason bash refuses to inherit PS1 in some circumstances -# that I can't figure out. Putting PS1 here ensures that it gets loaded every -# time. -# \h = Display hostname -# \s = Display shell name (bash) -# \v = Display shell version -# \w = Display complete path -# \W = Dispaly only current directory -# \$ = Display '#' -#PS1="\h(\W)\$" - -if [ "$TERM" = "linux" ]; then - #we're on the system console or maybe telnetting in - export PS1="\u(\W)\$" - #export PS1="\[\e[32;1m\]\u@\H > \[\e[0m\]" -else - #we're not on the console, assume an xterm - #export PS1="\[\e]2;\u@\H \w\a\e[32;1m\]>\[\e[0m\] " - export PS1="\[\e]2;[\u] \w\a\e[32;1m\]>\[\e[0m\] " -fi -EOF - -echo "Creating /etc/inputrc" && -cat > /etc/inputrc << "EOF" && -# Begin /etc/inputrc - -# Enable 8bit input -set meta-flag On -set input-meta On -# Turns off 8th bit stripping -set convert-meta Off -# Keep the 8th bit for display -set output-meta On - -# none, visible or audible -set bell-style none - -# All of the following map the escape sequence of the value contained inside -# the 1st argument to the readline specific functions -"\eOd": backward-word -"\eOc": forward-word -# for linux console -"\e[1~": beginning-of-line -"\e[4~": end-of-line -"\e[5~": beginning-of-history -"\e[6~": end-of-history -"\e[3~": delete-char -"\e[2~": quoted-insert -# for xterm -"\eOH": beginning-of-line -"\eOF": end-of-line -EOF - - -echo "Creating /etc/skel and it's files" && -mkdir -p /etc/skel && -cat > /etc/skel/.bash_logout << "EOF" && -# ~/.bash_logout - -clear -EOF - -cat > /etc/skel/.bash_profile << "EOF" && -# ~/.bash_profile - -# User specific environment and startup programs -# This file is the second read by bash during the logon process. - -# Get the aliases and functions -if [ -f ~/.bashrc ]; then - . ~/.bashrc -fi - -BASH_ENV=$HOME/.bashrc - -export BASH_ENV - -unset USERNAME -EOF - -cat > /etc/skel/.bashrc << "EOF" && -# ~/.bashrc - -# User specific aliases and functions -# This file is executed each time an xterm window -# is started. - -# Source global definitions -if [ -f /etc/bashrc ]; then - . /etc/bashrc -fi - -alias rm='rm -i' -alias mv='mv -i' -alias cp='cp -i' -EOF - -echo "Creating /etc/host.conf" && -cat > /etc/host.conf << "EOF" && +echo "Creating /etc/host.conf" +cat > /etc/host.conf << "EOF" # /etc/host.conf # # Lookup names via DNS first then fall back to /etc/hosts. @@ -217,19 +19,6 @@ multi on # Check for IP address spoofing. nospoof on EOF -chmod 644 /etc/host.conf && - -echo "Creating /etc/shells" && -cat > /etc/shells << "EOF" && -/bin/sh -/bin/bash -EOF -chmod 644 /etc/shells && - -echo "Installing /etc/DIR_COLORS" && -install -m644 ${CWD}/misc/DIR_COLORS /etc/DIR_COLORS && - -echo "Creating /etc/shutdown.allow" && -echo "${REGUSER}" > /etc/shutdown.allow +chmod 644 /etc/host.conf exit $?