From f27cf5c2afe49f135bad084732b451475c1a1a7c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 27 Mar 2009 12:34:11 +0100 Subject: [PATCH] Rename xbps-base-dirs to xbps-base-files. Install some default configuation files by default, based on Fedora and Archlinux. --HG-- extra : convert_revision : 28a0ac3594338bbd761c8c68559d09d8e9aec54d --- templates/glibc/template | 2 +- templates/xbps-base-chroot/template | 2 +- templates/xbps-base-dirs/template | 58 ------------- templates/xbps-base-files/files/colorls.sh | 40 +++++++++ .../xbps-base-files/files/dot_bash_logout | 2 + .../xbps-base-files/files/dot_bash_profile | 13 +++ templates/xbps-base-files/files/dot_bashrc | 8 ++ templates/xbps-base-files/files/host.conf | 8 ++ templates/xbps-base-files/files/hosts | 8 ++ templates/xbps-base-files/files/profile | 60 +++++++++++++ templates/xbps-base-files/files/securetty | 23 +++++ .../xbps-base-files/files/usb-load-ehci-first | 5 ++ templates/xbps-base-files/files/vim.sh | 6 ++ templates/xbps-base-files/files/which2.sh | 4 + templates/xbps-base-files/template | 86 +++++++++++++++++++ templates/xbps-base-system/template | 2 +- 16 files changed, 266 insertions(+), 61 deletions(-) delete mode 100644 templates/xbps-base-dirs/template create mode 100644 templates/xbps-base-files/files/colorls.sh create mode 100644 templates/xbps-base-files/files/dot_bash_logout create mode 100644 templates/xbps-base-files/files/dot_bash_profile create mode 100644 templates/xbps-base-files/files/dot_bashrc create mode 100644 templates/xbps-base-files/files/host.conf create mode 100644 templates/xbps-base-files/files/hosts create mode 100644 templates/xbps-base-files/files/profile create mode 100644 templates/xbps-base-files/files/securetty create mode 100644 templates/xbps-base-files/files/usb-load-ehci-first create mode 100644 templates/xbps-base-files/files/vim.sh create mode 100644 templates/xbps-base-files/files/which2.sh create mode 100644 templates/xbps-base-files/template diff --git a/templates/glibc/template b/templates/glibc/template index e8b91f98cf4..60102dd0801 100644 --- a/templates/glibc/template +++ b/templates/glibc/template @@ -32,7 +32,7 @@ subpackages="devel locales" Add_dependency build gcc Add_dependency build gawk Add_dependency build kernel-libc-headers -Add_dependency run xbps-base-dirs +Add_dependency run xbps-base-files Add_dependency run gcc-libgcc Add_dependency run glibc-locales diff --git a/templates/xbps-base-chroot/template b/templates/xbps-base-chroot/template index 9f23368765a..164a6dbb9b6 100644 --- a/templates/xbps-base-chroot/template +++ b/templates/xbps-base-chroot/template @@ -11,7 +11,7 @@ long_desc=" noarch=yes base_chroot=yes -Add_dependency full xbps-base-dirs +Add_dependency full xbps-base-files Add_dependency full ncurses Add_dependency full texinfo Add_dependency full gettext diff --git a/templates/xbps-base-dirs/template b/templates/xbps-base-dirs/template deleted file mode 100644 index c19f82f91ed..00000000000 --- a/templates/xbps-base-dirs/template +++ /dev/null @@ -1,58 +0,0 @@ -# Template file for 'xbps-base-dirs' -pkgname=xbps-base-dirs -version=0.7 -build_style=custom-install -short_desc="xbps base system directories" -maintainer="Juan RP " -long_desc=" - This package installs the base system directories as well - as some required files for xbps." - -base_chroot=yes -noarch=yes - -do_install() -{ - for f in bin sbin boot etc home lib dev proc mnt opt sys var \ - media/cdrom; do - mkdir -p $DESTDIR/$f - done - - mkdir -p -m 0750 $DESTDIR/root - mkdir -p -m 1777 $DESTDIR/tmp $DESTDIR/var/tmp - - for f in local local/bin local/sbin local/include local/lib \ - bin include lib sbin src; do - mkdir -p $DESTDIR/usr/$f - done - - for f in locale misc terminfo zoneinfo doc info; do - mkdir -p $DESTDIR/usr/share/$f - mkdir -p $DESTDIR/usr/local/share/$f - done - - for f in 1 2 3 4 5 6 7 8; do - mkdir -p $DESTDIR/usr/share/man/man$f - mkdir -p $DESTDIR/usr/local/share/man/man$f - done - - cd $DESTDIR/usr && ln -s ./share/man man - cd $DESTDIR/usr/local && ln -s ./share/man man - - for f in lock log mail run spool opt cache lib; do - mkdir -p $DESTDIR/var/$f - done - - if [ "$xbps_machine" = "x86_64" ]; then - mkdir -p $DESTDIR/usr/lib - mkdir -p $DESTDIR/lib - cd $DESTDIR && ln -s lib lib64 - cd $DESTDIR/usr && ln -s lib lib64 - fi - - for f in info-files initramfs-tools register-shell xml-catalog \ - x11-fonts; do - install -D -m 755 $XBPS_TRIGGERSDIR/$f \ - $DESTDIR/var/db/xbps/triggers/$(basename $f) - done -} diff --git a/templates/xbps-base-files/files/colorls.sh b/templates/xbps-base-files/files/colorls.sh new file mode 100644 index 00000000000..e73cc429b0a --- /dev/null +++ b/templates/xbps-base-files/files/colorls.sh @@ -0,0 +1,40 @@ +# color-ls initialization + +#when USER_LS_COLORS defined do not override user LS_COLORS, but use them. +if [ -z "$USER_LS_COLORS" ]; then + + alias ll='ls -l' 2>/dev/null + alias l.='ls -d .*' 2>/dev/null + + + # Skip the rest for noninteractive shells. + [ -z "$PS1" ] && return + + COLORS= + + for colors in "$HOME/.dir_colors.$TERM" "$HOME/.dircolors.$TERM" \ + "$HOME/.dir_colors" "$HOME/.dircolors"; do + [ -e "$colors" ] && COLORS="$colors" && break + done + + [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \ + [ "x`tput colors 2>/dev/null`" = "x256" ] && \ + COLORS="/etc/DIR_COLORS.256color" + + if [ -z "$COLORS" ]; then + for colors in "/etc/DIR_COLORS.$TERM" "/etc/DIR_COLORS" ; do + [ -e "$colors" ] && COLORS="$colors" && break + done + fi + + # Existence of $COLORS already checked above. + [ -n "$COLORS" ] || return + + eval `dircolors --sh "$COLORS" 2>/dev/null` + [ -z "$LS_COLORS" ] && return + egrep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return +fi + +alias ll='ls -l --color=auto' 2>/dev/null +alias l.='ls -d .* --color=auto' 2>/dev/null +alias ls='ls --color=auto' 2>/dev/null diff --git a/templates/xbps-base-files/files/dot_bash_logout b/templates/xbps-base-files/files/dot_bash_logout new file mode 100644 index 00000000000..af7c6fd8fd1 --- /dev/null +++ b/templates/xbps-base-files/files/dot_bash_logout @@ -0,0 +1,2 @@ +# ~/.bash_logout + diff --git a/templates/xbps-base-files/files/dot_bash_profile b/templates/xbps-base-files/files/dot_bash_profile new file mode 100644 index 00000000000..eca076703ea --- /dev/null +++ b/templates/xbps-base-files/files/dot_bash_profile @@ -0,0 +1,13 @@ +# .bash_profile + +# Get the aliases and functions +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +# User specific environment and startup programs + +PATH=$PATH:$HOME/bin +PS1="[\u@\h \W]$ " + +export PATH PS1 diff --git a/templates/xbps-base-files/files/dot_bashrc b/templates/xbps-base-files/files/dot_bashrc new file mode 100644 index 00000000000..c4b7f22fed1 --- /dev/null +++ b/templates/xbps-base-files/files/dot_bashrc @@ -0,0 +1,8 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# User specific aliases and functions diff --git a/templates/xbps-base-files/files/host.conf b/templates/xbps-base-files/files/host.conf new file mode 100644 index 00000000000..cf52fe56106 --- /dev/null +++ b/templates/xbps-base-files/files/host.conf @@ -0,0 +1,8 @@ +# +# /etc/host.conf +# + +order hosts,bind +multi on + +# End of file diff --git a/templates/xbps-base-files/files/hosts b/templates/xbps-base-files/files/hosts new file mode 100644 index 00000000000..1cfa1760073 --- /dev/null +++ b/templates/xbps-base-files/files/hosts @@ -0,0 +1,8 @@ +# +# /etc/hosts: static lookup table for host names +# + +# +127.0.0.1 localhost.localdomain localhost + +# End of file diff --git a/templates/xbps-base-files/files/profile b/templates/xbps-base-files/files/profile new file mode 100644 index 00000000000..a48dc12e1e4 --- /dev/null +++ b/templates/xbps-base-files/files/profile @@ -0,0 +1,60 @@ +# /etc/profile + +# System wide environment and startup programs, for login setup +# Functions and aliases go in /etc/bashrc + +pathmunge () { + if ! echo $PATH | /usr/bin/egrep -q "(^|:)$1($|:)" ; then + if [ "$2" = "after" ] ; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi + fi +} + +# ksh workaround +if [ -z "$EUID" -a -x /bin/id ]; then + EUID=`id -u` + UID=`id -ru` +fi + +# Path manipulation +if [ "$EUID" = "0" ]; then + pathmunge /sbin + pathmunge /usr/sbin + pathmunge /usr/local/sbin +else + pathmunge /usr/local/sbin after + pathmunge /usr/sbin after + pathmunge /sbin after +fi + +# No core files by default +ulimit -S -c 0 > /dev/null 2>&1 + +if [ -x /bin/id ]; then + USER="`id -un`" + LOGNAME=$USER + MAIL="/var/spool/mail/$USER" +fi + +HOSTNAME=`/bin/hostname 2>/dev/null` +HISTSIZE=1000 + +export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE + +for i in /etc/profile.d/*.sh ; do + if [ -r "$i" ]; then + if [ "$PS1" ]; then + . $i + else + . $i >/dev/null 2>&1 + fi + fi +done + +export PATH + +unset i +unset pathmunge diff --git a/templates/xbps-base-files/files/securetty b/templates/xbps-base-files/files/securetty new file mode 100644 index 00000000000..525f4de1c81 --- /dev/null +++ b/templates/xbps-base-files/files/securetty @@ -0,0 +1,23 @@ +console +vc/1 +vc/2 +vc/3 +vc/4 +vc/5 +vc/6 +vc/7 +vc/8 +vc/9 +vc/10 +vc/11 +tty1 +tty2 +tty3 +tty4 +tty5 +tty6 +tty7 +tty8 +tty9 +tty10 +tty11 diff --git a/templates/xbps-base-files/files/usb-load-ehci-first b/templates/xbps-base-files/files/usb-load-ehci-first new file mode 100644 index 00000000000..f90d5532685 --- /dev/null +++ b/templates/xbps-base-files/files/usb-load-ehci-first @@ -0,0 +1,5 @@ +# +# Load the EHCI driver before OHCI or UHCI, to avoid a warning. +# +install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe --ignore-install ohci_hcd $CMDLINE_OPTS +install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe --ignore-install uhci_hcd $CMDLINE_OPTS diff --git a/templates/xbps-base-files/files/vim.sh b/templates/xbps-base-files/files/vim.sh new file mode 100644 index 00000000000..d063a483275 --- /dev/null +++ b/templates/xbps-base-files/files/vim.sh @@ -0,0 +1,6 @@ +if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ]; then + [ -x //usr/bin/id ] || return + [ `//usr/bin/id -u` -le 100 ] && return + # for bash and zsh, only if no alias is already set + alias vi >/dev/null 2>&1 || alias vi=vim +fi diff --git a/templates/xbps-base-files/files/which2.sh b/templates/xbps-base-files/files/which2.sh new file mode 100644 index 00000000000..14ca09f4ea8 --- /dev/null +++ b/templates/xbps-base-files/files/which2.sh @@ -0,0 +1,4 @@ +# Initialization script for bash and sh + +# export AFS if you are in AFS environment +alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' diff --git a/templates/xbps-base-files/template b/templates/xbps-base-files/template new file mode 100644 index 00000000000..45c04ba4dd2 --- /dev/null +++ b/templates/xbps-base-files/template @@ -0,0 +1,86 @@ +# Template file for 'xbps-base-files' +pkgname=xbps-base-files +version=0.8 +build_style=custom-install +short_desc="xbps base system files" +maintainer="Juan RP " +long_desc=" + This package installs the base system files and directories that + aren't installed by any other package and are required on any + GNU/Linux system." + +base_chroot=yes +noarch=yes + +conf_files="/etc/profile /etc/hosts /etc/host.conf /etc/securetty + /etc/skel/.bash_profile /etc/skel/.bash_logout /etc/skel/.bashrc" + +do_install() +{ + # + # Install FHS system directories. + # + for d in bin sbin boot etc home lib dev proc mnt opt sys var \ + media; do + install -d ${DESTDIR}/${d} + done + + install -d -m750 ${DESTDIR}/root + for d in tmp var/tmp var/lock var/spool/mail; do + install -d -m1777 ${DESTDIR}/${d} + done + + for d in local local/bin local/sbin local/include local/lib \ + bin include lib sbin src; do + install -d ${DESTDIR}/usr/${d} + done + + for d in locale misc terminfo zoneinfo doc info; do + install -d ${DESTDIR}/usr/share/${d} + install -d ${DESTDIR}/usr/local/share/${d} + done + + for f in 1 2 3 4 5 6 7 8; do + install -d ${DESTDIR}/usr/share/man/man${d} + install -d ${DESTDIR}/usr/local/share/man/man${d} + done + + cd ${DESTDIR}/usr && ln -s ./share/man man + cd ${DESTDIR}/usr/local && ln -s ./share/man man + + for d in log run opt cache lib; do + install -d ${DESTDIR}/var/${d} + done + + if [ "$xbps_machine" = "x86_64" ]; then + install -d ${DESTDIR}/usr/lib + install -d ${DESTDIR}/lib + cd ${DESTDIR} && ln -s lib lib64 + cd ${DESTDIR}/usr && ln -s lib lib64 + fi + + # + # Install trigger files. + # + install -d ${DESTDIR}/var/db/xbps/triggers + install -m755 ${XBPS_TRIGGERSDIR}/* ${DESTDIR}/var/db/xbps/triggers + + # + # Install misc config files. + # + for f in bash_logout bash_profile bashrc; do + install -D -m644 ${FILESDIR}/dot_${f} ${DESTDIR}/etc/skel/.${f} + done + + install -m644 ${FILESDIR}/profile ${DESTDIR}/etc + install -m600 ${FILESDIR}/securetty ${DESTDIR}/etc + install -m644 ${FILESDIR}/hosts ${DESTDIR}/etc + install -m644 ${FILESDIR}/host.conf ${DESTDIR}/etc + + install -d ${DESTDIR}/etc/profile.d + install -m644 ${FILESDIR}/*.sh ${DESTDIR}/etc/profile.d + + install -d ${DESTDIR}/etc/modprobe.d + install -D -m644 ${FILESDIR}/usb-load-ehci-first \ + ${DESTDIR}/etc/modprobe.d +} diff --git a/templates/xbps-base-system/template b/templates/xbps-base-system/template index a964fc6d780..0112094387a 100644 --- a/templates/xbps-base-system/template +++ b/templates/xbps-base-system/template @@ -10,7 +10,7 @@ long_desc=" noarch=yes -Add_dependency full xbps-base-dirs +Add_dependency full xbps-base-files Add_dependency full texinfo Add_dependency full coreutils Add_dependency full dash