diff --git a/bash/PKGBUILD b/bash/PKGBUILD index 4a40c42a..8f40135e 100644 --- a/bash/PKGBUILD +++ b/bash/PKGBUILD @@ -4,24 +4,14 @@ pkgname=('bash' 'bash-devel') _basever=4.3 _patchlevel=018 #prepare for some patches pkgver=$_basever.$_patchlevel -pkgrel=2 +pkgrel=3 pkgdesc="The GNU Bourne Again shell" arch=('i686' 'x86_64') license=('GPL') url="http://www.gnu.org/software/bash/bash.html" groups=('base') -backup=(etc/bash.bash{rc,_logout} etc/skel/.bash{rc,_profile,_logout}) makedepends=('gettext-devel' 'libreadline-devel>=6.3') source=(http://ftp.gnu.org/gnu/bash/bash-$_basever.tar.gz{,.sig} - 'dot.bashrc' - 'dot.bash_profile' - 'dot.bash_logout' - 'dot.inputrc' - 'system.bashrc' - 'system.bash_logout' - 'system.profile' - 'profile.tzset.sh' - 'profile.lang.sh' 0001-bash-4.3-cygwin.patch 0002-bash-4.3-msysize.patch 0003-bash-4.3-readline.patch @@ -102,23 +92,6 @@ package_bash() { unset until wait while [ ; do cp -fp alias.1.gz $f.1.gz done - - install -dm755 ${pkgdir}/etc/skel/ - - # system-wide configuration files - install -m644 ${srcdir}/system.bashrc ${pkgdir}/etc/bash.bashrc - install -m644 ${srcdir}/system.bash_logout ${pkgdir}/etc/bash.bash_logout - install -m644 ${srcdir}/system.profile ${pkgdir}/etc/profile - - # user configuration file skeletons - install -m644 ${srcdir}/dot.bashrc ${pkgdir}/etc/skel/.bashrc - install -m644 ${srcdir}/dot.inputrc ${pkgdir}/etc/skel/.inputrc - install -m644 ${srcdir}/dot.bash_profile ${pkgdir}/etc/skel/.bash_profile - install -m644 ${srcdir}/dot.bash_logout ${pkgdir}/etc/skel/.bash_logout - - install -dm755 ${pkgdir}/etc/profile.d/ - install -m644 ${srcdir}/profile.tzset.sh ${pkgdir}/etc/profile.d/tzset.sh - install -m644 ${srcdir}/profile.lang.sh ${pkgdir}/etc/profile.d/lang.sh } package_bash-devel() { @@ -135,21 +108,12 @@ package_bash-devel() { mkdir -p ${pkgdir}/usr/include/bash for f in [^y]*.h builtins/*.h include/*.h lib/{glob,tilde}/*.h do - /bin/install ${f} ${pkgdir}/usr/include/bash + /usr/bin/install ${f} ${pkgdir}/usr/include/bash done } md5sums=('81348932d5da294953e15d4814c74dd1' 'SKIP' - 'e713dd521ef91e55e0a9a9443cfeff5f' - '8c8d3d50a5ddeec7b1ad9fb30b313568' - '42f4400ed2314bd7519c020d0187edc5' - '1d47ffe43eb63cd769212bca5d5faef3' - '6fe29f98baec010642cbbaeef93b0422' - 'f04674a1f8bf8802b61d61c7b86d3781' - 'bd8e0c8b7b950680dcf8ca55b8e7c854' - 'edb8c2727e45be31bdbcaa0aa7259f19' - '423b1c9e51a5cf569158bf8798c5b4fc' '38de129c387f1261ed3a9a373459b97a' '03696955885df2bae6ecc647157cf808' 'c9e601e7ed62007affc1e6e2833595a8' diff --git a/bash/dot.bash_profile b/bash/dot.bash_profile deleted file mode 100644 index 053e8e8c..00000000 --- a/bash/dot.bash_profile +++ /dev/null @@ -1,44 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# ~/.bash_profile: executed by bash(1) for login shells. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/skel/.bash_profile - -# Modifying /etc/skel/.bash_profile directly will prevent -# setup from updating it. - -# The copy in your home directory (~/.bash_profile) is yours, please -# feel free to customise it to create a shell -# environment to your liking. If you feel a change -# would be benifitial to all, please feel free to send -# a patch to the cygwin mailing list. - -# User dependent .bash_profile file - -# source the users bashrc if it exists -if [ -f "${HOME}/.bashrc" ] ; then - source "${HOME}/.bashrc" -fi - -# Set PATH so it includes user's private bin if it exists -# if [ -d "${HOME}/bin" ] ; then -# PATH="${HOME}/bin:${PATH}" -# fi - -# Set MANPATH so it includes users' private man if it exists -# if [ -d "${HOME}/man" ]; then -# MANPATH="${HOME}/man:${MANPATH}" -# fi - -# Set INFOPATH so it includes users' private info if it exists -# if [ -d "${HOME}/info" ]; then -# INFOPATH="${HOME}/info:${INFOPATH}" -# fi diff --git a/bash/dot.bashrc b/bash/dot.bashrc deleted file mode 100644 index 507cae6f..00000000 --- a/bash/dot.bashrc +++ /dev/null @@ -1,198 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# ~/.bashrc: executed by bash(1) for interactive shells. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/skel/.bashrc - -# Modifying /etc/skel/.bashrc directly will prevent -# setup from updating it. - -# The copy in your home directory (~/.bashrc) is yours, please -# feel free to customise it to create a shell -# environment to your liking. If you feel a change -# would be benifitial to all, please feel free to send -# a patch to the cygwin mailing list. - -# User dependent .bashrc file - -# If not running interactively, don't do anything -[[ "$-" != *i* ]] && return - -# Shell Options -# -# See man bash for more options... -# -# Don't wait for job termination notification -# set -o notify -# -# Don't use ^D to exit -# set -o ignoreeof -# -# Use case-insensitive filename globbing -# shopt -s nocaseglob -# -# Make bash append rather than overwrite the history on disk -# shopt -s histappend -# -# When changing directory small typos can be ignored by bash -# for example, cd /vr/lgo/apaache would find /var/log/apache -# shopt -s cdspell - -# Completion options -# -# These completion tuning parameters change the default behavior of bash_completion: -# -# Define to access remotely checked-out files over passwordless ssh for CVS -# COMP_CVS_REMOTE=1 -# -# Define to avoid stripping description in --option=description of './configure --help' -# COMP_CONFIGURE_HINTS=1 -# -# Define to avoid flattening internal contents of tar files -# COMP_TAR_INTERNAL_PATHS=1 -# -# Uncomment to turn on programmable completion enhancements. -# Any completions you add in ~/.bash_completion are sourced last. -# [[ -f /etc/bash_completion ]] && . /etc/bash_completion - -# History Options -# -# Don't put duplicate lines in the history. -# export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups -# -# Ignore some controlling instructions -# HISTIGNORE is a colon-delimited list of patterns which should be excluded. -# The '&' is a special pattern which suppresses duplicate entries. -# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit' -# export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:ls' # Ignore the ls command as well -# -# Whenever displaying the prompt, write the previous line to disk -# export PROMPT_COMMAND="history -a" - -# Aliases -# -# Some people use a different file for aliases -# if [ -f "${HOME}/.bash_aliases" ]; then -# source "${HOME}/.bash_aliases" -# fi -# -# Some example alias instructions -# If these are enabled they will be used instead of any instructions -# they may mask. For example, alias rm='rm -i' will mask the rm -# application. To override the alias instruction use a \ before, ie -# \rm will call the real rm not the alias. -# -# Interactive operation... -# alias rm='rm -i' -# alias cp='cp -i' -# alias mv='mv -i' -# -# Default to human readable figures -# alias df='df -h' -# alias du='du -h' -# -# Misc :) -# alias less='less -r' # raw control characters -# alias whence='type -a' # where, of a sort -# alias grep='grep --color' # show differences in colour -# alias egrep='egrep --color=auto' # show differences in colour -# alias fgrep='fgrep --color=auto' # show differences in colour -# -# Some shortcuts for different directory listings -# alias ls='ls -hF --color=tty' # classify files in colour -# alias dir='ls --color=auto --format=vertical' -# alias vdir='ls --color=auto --format=long' -# alias ll='ls -l' # long list -# alias la='ls -A' # all but . and .. -# alias l='ls -CF' # - -# Umask -# -# /etc/profile sets 022, removing write perms to group + others. -# Set a more restrictive umask: i.e. no exec perms for others: -# umask 027 -# Paranoid: neither group nor others have any perms: -# umask 077 - -# Functions -# -# Some people use a different file for functions -# if [ -f "${HOME}/.bash_functions" ]; then -# source "${HOME}/.bash_functions" -# fi -# -# Some example functions: -# -# a) function settitle -# settitle () -# { -# echo -ne "\e]2;$@\a\e]1;$@\a"; -# } -# -# b) function cd_func -# This function defines a 'cd' replacement function capable of keeping, -# displaying and accessing history of visited directories, up to 10 entries. -# To use it, uncomment it, source this file and try 'cd --'. -# acd_func 1.0.5, 10-nov-2004 -# Petar Marinov, http:/geocities.com/h2428, this is public domain -# cd_func () -# { -# local x2 the_new_dir adir index -# local -i cnt -# -# if [[ $1 == "--" ]]; then -# dirs -v -# return 0 -# fi -# -# the_new_dir=$1 -# [[ -z $1 ]] && the_new_dir=$HOME -# -# if [[ ${the_new_dir:0:1} == '-' ]]; then -# # -# # Extract dir N from dirs -# index=${the_new_dir:1} -# [[ -z $index ]] && index=1 -# adir=$(dirs +$index) -# [[ -z $adir ]] && return 1 -# the_new_dir=$adir -# fi -# -# # -# # '~' has to be substituted by ${HOME} -# [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" -# -# # -# # Now change to the new dir and add to the top of the stack -# pushd "${the_new_dir}" > /dev/null -# [[ $? -ne 0 ]] && return 1 -# the_new_dir=$(pwd) -# -# # -# # Trim down everything beyond 11th entry -# popd -n +11 2>/dev/null 1>/dev/null -# -# # -# # Remove any other occurence of this dir, skipping the top of the stack -# for ((cnt=1; cnt <= 10; cnt++)); do -# x2=$(dirs +${cnt} 2>/dev/null) -# [[ $? -ne 0 ]] && return 0 -# [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" -# if [[ "${x2}" == "${the_new_dir}" ]]; then -# popd -n +$cnt 2>/dev/null 1>/dev/null -# cnt=cnt-1 -# fi -# done -# -# return 0 -# } -# -# alias cd=cd_func diff --git a/bash/dot.inputrc b/bash/dot.inputrc deleted file mode 100644 index e2e5e094..00000000 --- a/bash/dot.inputrc +++ /dev/null @@ -1,120 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# ~/.inputrc: readline initialization file. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/skel/.inputrc - -# Modifying /etc/skel/.inputrc directly will prevent -# setup from updating it. - -# The copy in your home directory (~/.inputrc) is yours, please -# feel free to customise it to create a shell -# environment to your liking. If you feel a change -# would be benifitial to all, please feel free to send -# a patch to the cygwin mailing list. - -# the following line is actually -# equivalent to "\C-?": delete-char -# "\e[3~": delete-char - -# VT -# "\e[1~": beginning-of-line -# "\e[4~": end-of-line - -# kvt -# "\e[H": beginning-of-line -# "\e[F": end-of-line - -# rxvt and konsole (i.e. the KDE-app...) -# "\e[7~": beginning-of-line -# "\e[8~": end-of-line - -# VT220 -# "\eOH": beginning-of-line -# "\eOF": end-of-line - -# Allow 8-bit input/output -# set meta-flag on -# set convert-meta off -# set input-meta on -# set output-meta on -#$if Bash - # Don't ring bell on completion - set bell-style none - - # or, don't beep at me - show me - #set bell-style visible - - # Show all instead of beeping first - set show-all-if-ambiguous off - - # Filename completion/expansion - set completion-ignore-case on - #set show-all-if-ambiguous on - - # Expand homedir name - #set expand-tilde on - - # Append "/" to all dirnames - #set mark-directories on - #set mark-symlinked-directories on - - # visible-stats - # Append a mark according to the file type in a listing - set visible-stats off - set mark-directories on - - # Match all files - #set match-hidden-files on - - # 'Magic Space' - # Insert a space character then performs - # a history expansion in the line - #Space: magic-space -#$endif - -# MSYSTEM is emacs based -$if mode=emacs - # Common to Console & RXVT - "\C-?": backward-kill-line # Ctrl-BackSpace - "\e[2~": paste-from-clipboard # "Ins. Key" - "\e[5~": beginning-of-history # Page up - "\e[6~": end-of-history # Page down - - $if term=msys # RXVT - "\e[7~": beginning-of-line # Home Key - "\e[8~": end-of-line # End Key - "\e[11~": display-shell-version # F1 - "\e[15~": re-read-init-file # F5 - "\e[12~": "Function Key 2" - "\e[13~": "Function Key 3" - "\e[14~": "Function Key 4" - "\e[17~": "Function Key 6" - "\e[18~": "Function Key 7" - "\e[19~": "Function Key 8" - "\e[20~": "Function Key 9" - "\e[21~": "Function Key 10" - $else - # Eh, normal Console is not really cygwin anymore, is it? Using 'else' instead. -mstormo - # $if term=cygwin # Console - "\e[1~": beginning-of-line # Home Key - "\e[4~": end-of-line # End Key - "\e[3~": delete-char # Delete Key - "\e\e[C": forward-word # Alt-Right - "\e\e[D": backward-word # Alt-Left - "\e[17~": "Function Key 6" - "\e[18~": "Function Key 7" - "\e[19~": "Function Key 8" - "\e[20~": "Function Key 9" - "\e[21~": "Function Key 10" - "\e[23~": "Function Key 11" - $endif -$endif \ No newline at end of file diff --git a/bash/dot.profile b/bash/dot.profile deleted file mode 100644 index 360eed31..00000000 --- a/bash/dot.profile +++ /dev/null @@ -1,37 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# ~/.profile: executed by the command interpreter for login shells. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/skel/.profile - -# Modifying /etc/skel/.profile directly will prevent -# setup from updating it. - -# The copy in your home directory (~/.profile) is yours, please -# feel free to customise it to create a shell -# environment to your liking. If you feel a change -# would be benificial to all, please feel free to send -# a patch to the cygwin mailing list. - -# User dependent .profile file - -# Set user-defined locale -export LANG=$(locale -uU) - -# This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login -# exists. -# -# if running bash -if [ -n "${BASH_VERSION}" ]; then - if [ -f "${HOME}/.bashrc" ]; then - source "${HOME}/.bashrc" - fi -fi diff --git a/bash/profile.lang.sh b/bash/profile.lang.sh deleted file mode 100644 index 83574aa0..00000000 --- a/bash/profile.lang.sh +++ /dev/null @@ -1,21 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# /etc/profile.d/lang.sh: sourced by /etc/profile. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/profile.d/lang.sh - -# Modifying /etc/profile.d/lang.sh directly will prevent -# setup from updating it. - -# System-wide lang.sh file - -# if no locale variable is set, indicate terminal charset via LANG -test -z "${LC_ALL:-${LC_CTYPE:-$LANG}}" && export LANG=$(/usr/bin/locale -uU) diff --git a/bash/profile.tzset.sh b/bash/profile.tzset.sh deleted file mode 100644 index dc3eed51..00000000 --- a/bash/profile.tzset.sh +++ /dev/null @@ -1,24 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# /etc/profile.d/tzset.sh: sourced by /etc/profile. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/profile.d/tzset.sh - -# Modifying /etc/profile.d/tzset.sh directly will prevent -# setup from updating it. - -# System-wide tzset.sh file - -#Uses the geographical location setting of the user to find the right -#mapping, rather than the locale setting. Only on Windows 2000 which -#doesn't know about the user's geographical location, or if fetching -#the geographical location fails, it falls back to the user's locale. -test -z "$TZ" && export TZ=$(/usr/bin/tzset) diff --git a/bash/system.bash_logout b/bash/system.bash_logout deleted file mode 100644 index 5e73fe46..00000000 --- a/bash/system.bash_logout +++ /dev/null @@ -1,23 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# /etc/bash.bash_logout: executed by bash(1) when login shell exits. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/bash.bash_logout - -# Modifying /etc/bash.bash_logout directly will prevent -# setup from updating it. - -# System-wide bashrc file - -# when leaving the console clear the screen to increase privacy -if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear ] && /usr/bin/clear -fi diff --git a/bash/system.bashrc b/bash/system.bashrc deleted file mode 100644 index 81a2d6e3..00000000 --- a/bash/system.bashrc +++ /dev/null @@ -1,30 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.1-1 - -# /etc/bash.bashrc: executed by bash(1) for interactive shells. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/bash.bashrc - -# Modifying /etc/bash.bashrc directly will prevent -# setup from updating it. - -# System-wide bashrc file - -# Check that we haven't already been sourced. -([[ -z ${CYG_SYS_BASHRC} ]] && CYG_SYS_BASHRC="1") || return - -# If not running interactively, don't do anything -[[ "$-" != *i* ]] && return - -# Set a default prompt of: user@host and current_directory -PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' - -# Uncomment to use the terminal colours set in DIR_COLORS -# eval "$(dircolors -b /etc/DIR_COLORS)" diff --git a/bash/system.profile b/bash/system.profile deleted file mode 100644 index fab17df7..00000000 --- a/bash/system.profile +++ /dev/null @@ -1,499 +0,0 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - - -# System-wide profile file - -# Some resources... -# Customizing Your Shell: http://www.dsl.org/cookbook/cookbook_5.html#SEC69 -# Consistent BackSpace and Delete Configuration: -# http://www.ibb.net/~anne/keyboard.html -# The Linux Documentation Project: http://www.tldp.org/ -# The Linux Cookbook: http://www.tldp.org/LDP/linuxcookbook/html/ -# Greg's Wiki http://mywiki.wooledge.org/ - -# Setup some default paths. Note that this order will allow user installed -# software to override 'system' software. -# Modifying these default path settings can be done in different ways. -# To learn more about startup files, refer to your shell's man page. - -MSYS2_PATH="/usr/local/bin:/usr/bin:/bin" -MANPATH="/usr/local/man:/usr/share/man:/usr/man:/share/man:${MANPATH}" -INFOPATH="/usr/local/info:/usr/share/info:/usr/info:/share/info:${INFOPATH}" -if [ -n "$MSYSTEM" ] -then - case "$MSYSTEM" in - MINGW32) - PATH="/mingw32/bin:${MSYS2_PATH}:${PATH}" - PKG_CONFIG_PATH="/mingw32/lib/pkgconfig" - MANPATH="/mingw32/share/man:${MANPATH}" - ;; - MINGW64) - PATH="/mingw64/bin:${MSYS2_PATH}:${PATH}" - PKG_CONFIG_PATH="/mingw64/lib/pkgconfig" - MANPATH="/mingw64/share/man:${MANPATH}" - ;; - MSYS) - PATH="${MSYS2_PATH}:/opt/bin:${PATH}" - PKG_CONFIG_PATH="/usr/lib/pkgconfig:/lib/pkgconfig" - ;; - *) - PATH="${MSYS2_PATH}:${PATH}" - ;; - esac -else - PATH="${MSYS2_PATH}:${PATH}" -fi - -MAYBE_FIRST_START=false -SYSCONFDIR="${SYSCONFDIR:=/etc}" - -# TMP and TEMP as defined in the Windows environment must be kept -# for windows apps, even if started from cygwin. However, leaving -# them set to the default Windows temporary directory or unset -# can have unexpected consequences for cygwin apps, so we define -# our own to match GNU/Linux behaviour. -ORIGINAL_TMP=$TMP -ORIGINAL_TEMP=$TEMP -unset TMP TEMP -tmp=$(cygpath -w "$ORIGINAL_TMP" 2> /dev/null) -temp=$(cygpath -w "$ORIGINAL_TEMP" 2> /dev/null) -TMP="/tmp" -TEMP="/tmp" - -# Define default printer -p='/proc/registry/HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device' -if [ -e "${p}" ] ; then - read -r PRINTER < "${p}" - PRINTER=${PRINTER%%,*} -fi -unset p - -print_flags () -{ - (( $1 & 0x0002 )) && echo -n "binary" || echo -n "text" - (( $1 & 0x0010 )) && echo -n ",exec" - (( $1 & 0x0040 )) && echo -n ",cygexec" - (( $1 & 0x0100 )) && echo -n ",notexec" -} - -maybe_create_fstab () -{ - local FSTAB="${SYSCONFDIR}/fstab" - local FSTABDIR="${SYSCONFDIR}/fstab.d" - - # Create fstab file if it doesn't exist. - if [ -e "${FSTAB}" -a ! -f "${FSTAB}" ] - then - # Try to move - mv -f "${FSTAB}" "${FSTAB}.orig" - if [ -e "${FSTAB}" -a ! -f "${FSTAB}" ] - then - echo - echo "${FSTAB} is existant but not a file." - echo "Since this file is specifying the mount points, this might" - echo "result in unexpected trouble. Please fix that manually." - echo - fi - fi - - if [ ! -e "${FSTAB}" ] - then - - # Create fstab default header - cat > ${FSTAB} << EOF -# For a description of the file format, see the Users Guide -# http://cygwin.com/cygwin-ug-net/using.html#mount-table - -# DO NOT REMOVE NEXT LINE. It remove cygdrive prefix from path -none / cygdrive binary,posix=0,noacl,user 0 0 -EOF - MAYBE_FIRST_START=true - fi - - # Check for ${FSTABDIR} directory - if [ -e "${FSTABDIR}" -a ! -d "${FSTABDIR}" ] - then - # No mercy. Try to remove. - rm -f "${FSTABDIR}" - if [ -e "${FSTABDIR}" -a ! -d "${FSTABDIR}" ] - then - echo - echo "${FSTABDIR} is existant but not a directory." - echo "Please fix that manually." - echo - exit 1 - fi - fi - - # Create it if necessary - if [ ! -e "${FSTABDIR}" ] - then - mkdir -m 1777 "${FSTABDIR}" - if [ ! -e "${FSTABDIR}" ] - then - echo - echo "Creating ${FSTABDIR} directory failed." - echo "Please fix that manually." - echo - exit 1 - fi - fi -} - -maybe_create_mtab () -{ - local MTAB="${SYSCONFDIR}/mtab" - # Create /etc/mtab as symlink to /proc/mounts - [ ! -L "${MTAB}" ] && ln -sf /proc/mounts ${MTAB} -} - -maybe_create_devs () -{ - local DEVDIR=/dev - # Check for ${DEVDIR} directory - if [ -e "${DEVDIR}" -a ! -d "${DEVDIR}" ] - then - # No mercy. Try to remove. - rm -f "${DEVDIR}" - if [ -e "${DEVDIR}" -a ! -d "${DEVDIR}" ] - then - echo - echo "${DEVDIR} is existant but not a directory." - echo "Please fix that manually, otherwise you WILL get problems." - echo - exit 1 - fi - fi - - # Create it if necessary - mkdir -m 755 "${DEVDIR}" 2> /dev/null - if [ ! -e "${DEVDIR}" ] - then - echo - echo "Creating ${DEVDIR} directory failed." - echo "Please fix that manually, otherwise you WILL get problems." - echo - exit 1 - fi - - # Check for ${DEVDIR}/shm directory (for POSIX semaphores and POSIX shared mem) - if [ -e "${DEVDIR}/shm" -a ! -d "${DEVDIR}/shm" ] - then - # No mercy. Try to remove. - rm -f "${DEVDIR}/shm" - if [ -e "${DEVDIR}/shm" -a ! -d "${DEVDIR}/shm" ] - then - echo - echo "${DEVDIR}/shm is existant but not a directory." - echo "POSIX semaphores and POSIX shared memory will not work" - echo - fi - fi - - # Create it if necessary - if [ ! -e "${DEVDIR}/shm" ] - then - mkdir -m 1777 "${DEVDIR}/shm" - if [ ! -e "${DEVDIR}/shm" ] - then - echo - echo "Creating ${DEVDIR}/shm directory failed." - echo "POSIX semaphores and POSIX shared memory will not work" - echo - fi - else - chmod 1777 "${DEVDIR}/shm" - fi - - # Check for ${DEVDIR}/mqueue directory (for POSIX message queues) - if [ -e "${DEVDIR}/mqueue" -a ! -d "${DEVDIR}/mqueue" ] - then - # No mercy. Try to remove. - rm -f "${DEVDIR}/mqueue" - if [ -e "${DEVDIR}/mqueue" -a ! -d "${DEVDIR}/mqueue" ] - then - echo - echo "${DEVDIR}/mqueue is existant but not a directory." - echo "POSIX message queues will not work" - echo - fi - fi - - # Create it if necessary - if [ ! -e "${DEVDIR}/mqueue" ] - then - mkdir -m 1777 "${DEVDIR}/mqueue" - if [ ! -e "${DEVDIR}/mqueue" ] - then - echo - echo "Creating ${DEVDIR}/mqueue directory failed." - echo "POSIX message queues will not work" - echo - fi - else - chmod 1777 "${DEVDIR}/mqueue" - fi - - # Install /dev/fd, /dev/std{in,out,err}. The bash builtin test was compiled - # to assume these exist, so use /bin/test to really check. - /usr/bin/test -h /dev/stdin || ln -sf /proc/self/fd/0 /dev/stdin - /usr/bin/test -h /dev/stdout || ln -sf /proc/self/fd/1 /dev/stdout - /usr/bin/test -h /dev/stderr || ln -sf /proc/self/fd/2 /dev/stderr - /usr/bin/test -h /dev/fd || ln -sf /proc/self/fd /dev/fd -} - - -maybe_create_passwd () -{ - # Create default /etc/passwd and /etc/group files - local created_passwd=no - local created_group=no - - if [ ! -e /etc/passwd -a ! -L /etc/passwd ] ; then - mkpasswd.exe -l -c > /etc/passwd - chmod 644 /etc/passwd - created_passwd=yes - MAYBE_FIRST_START=true - fi - - if [ ! -e /etc/group -a ! -L /etc/group ] ; then - mkgroup.exe -l -c > /etc/group - chmod 644 /etc/group - created_group=yes - MAYBE_FIRST_START=true - fi - - cp -fp /etc/group /tmp/group.mkgroup && \ - ( [ -w /etc/group ] || chmod --silent a+w /etc/group ; ) && \ - echo "root:S-1-5-32-544:0:" > /etc/group && \ - sed -e '/root:S-1-5-32-544:0:/d' /tmp/group.mkgroup >> /etc/group && \ - chmod --silent --reference=/etc/passwd /etc/group - rm -f /tmp/group.mkgroup - - # Deferred to be sure root group entry exists - [ "$created_passwd" = "yes" ] && chgrp --silent root /etc/passwd - [ "$created_group" = "yes" ] && chgrp --silent root /etc/group -} - -maybe_create_winetc () -{ - local FILES="hosts protocols services networks" - local WINSYS32HOME="$(/usr/bin/cygpath -S -w)" - local WINETC="${WINSYS32HOME}\\drivers\\etc" - - if [ ! -d "${WINETC}" ]; then - echo "Directory ${WINETC} does not exist; exiting" >&2 - echo "If directory name is garbage you need to update your msys package" >&2 - exit 1 - fi - - local mketc= - for mketc in ${FILES} - do - if [ ! -e "/etc/${mketc}" -a ! -L "/etc/${mketc}" ] - then - # Windows only uses the first 8 characters - local WFILE="${WINETC}\\$(expr substr "${mketc}" 1 8)" - /usr/bin/cp -p -v "${WFILE}" "/etc/${mketc}" - fi - done - - /usr/bin/chmod 1777 /tmp 2>/dev/null -} - - -maybe_create_home () -{ - # Set the user id - USER="$(id -un)" - - # Default to removing the write permission for group and other - # (files normally created with mode 777 become 755; files created with - # mode 666 become 644) - umask 022 - - # Here is how HOME is set, in order of priority, when starting from Windows - # 1) From existing HOME in the Windows environment, translated to a Posix path - # 2) from /etc/passwd, if there is an entry with a non empty directory field - # 3) from HOMEDRIVE/HOMEPATH - # 4) / (root) - # If the home directory doesn't exist, create it. - if [ ! -d "${HOME}" ]; then - if mkdir -p "${HOME}"; then - echo "Copying skeleton files." - echo "These files are for the users to personalise their cygwin experience." - echo - echo "They will never be overwritten nor automatically updated." - echo - cd /etc/skel || echo "WARNING: Failed attempt to cd into /etc/skel!" - local f= - /usr/bin/find . -type f | while read f; do - local fDest=${f#.} - if [ ! -e "${HOME}${fDest}" -a ! -L "${HOME}${fDest}" ]; then - /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}" - fi - done - else - echo "${HOME} could not be created." - { [ -d "${TEMP}" ] && HOME="${TEMP}"; } || - { [ -d "${TMP}" ] && HOME="${TMP}"; } || - { [ -d /tmp ] && HOME=/tmp; } || - HOME=/ - echo "Setting HOME to ${HOME}." - fi - fi - - # Start MSYS in selected folder - # c:\msys\usr\bin\bash -c "cd '%curdir'; export - # CHERE_INVOKING=1; exec /usr/bin/bash --login -i" - # - # Make sure we start in home unless invoked by CHERE - if [ ! -z "${CHERE_INVOKING}" ]; then - unset CHERE_INVOKING - else - cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!" - fi -} - -# Call functions -maybe_create_fstab -maybe_create_mtab -maybe_create_devs -maybe_create_passwd -maybe_create_winetc -maybe_create_home - -# Shell dependent settings -profile_d () -{ - local file= - for file in $(export LC_COLLATE=C; echo /etc/profile.d/*.$1); do - [ -e "${file}" ] && . "${file}" - done -} - -if [ ! "x${BASH_VERSION}" = "x" ]; then - HOSTNAME="$(/usr/bin/hostname)" - profile_d sh - [ -f "/etc/bash.bashrc" ] && . "/etc/bash.bashrc" -elif [ ! "x${KSH_VERSION}" = "x" ]; then - typeset -l HOSTNAME="$(/usr/bin/hostname)" - profile_d sh - PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n$ ') -elif [ ! "x${ZSH_VERSION}" = "x" ]; then - HOSTNAME="$(/usr/bin/hostname)" - profile_d zsh - PS1='(%n@%m)[%h] %~ %% ' -elif [ ! "x${POSH_VERSION}" = "x" ]; then - HOSTNAME="$(/usr/bin/hostname)" - PS1="$ " -else - HOSTNAME="$(/usr/bin/hostname)" - profile_d sh - PS1="$ " -fi - -export PATH MANPATH INFOPATH PKG_CONFIG_PATH USER TMP TEMP PRINTER HOSTNAME PS1 SHELL tmp temp -export TERM=xterm-256color - -# Check to see if mkpasswd/mkgroup needs to be run try and cut down the emails -# about this on the lists! -# -# The following are the conditions under which the group name special cases -# will appear (where uid and gid are the effective user and group ids -# for the current user, and pgsid is the primary group associated with the -# SID for the current user): -# mkpasswd: -# gid is not in /etc/group -# uid is not in /etc/passwd -# passwd/group_GID_clash(/): -# gid is not in /etc/group -# uid is in /etc/passwd -# pgsid is in /etc/group (and does not match gid) -# mkgroup: -# gid is not in /etc/group -# uid is in /etc/passwd -# pgsid is not in /etc/group -# -# If this message keeps appearing and you are sure it's a mistake (ie, don't -# email about it!), comment out the test below. -case "$(id -ng)" in -mkpasswd ) - echo "Your group is currently \"mkpasswd\". This indicates that your" - echo "gid is not in /etc/group and your uid is not in /etc/passwd." - echo - echo "The /etc/passwd (and possibly /etc/group) files should be rebuilt." - echo "See the man pages for mkpasswd and mkgroup then, for example, run" - echo - echo "mkpasswd -l [-d] > /etc/passwd" - echo "mkgroup -l [-d] > /etc/group" - echo - echo "Note that the -d switch is necessary for domain users." - ;; -passwd/group_GID_clash* ) - echo "Your group is currently \"passwd/group_GID_clash(gid/pgsid)\". This" - echo "indicates that your gid is not in /etc/group, but the pgsid (primary " - echo "group associated with your SID) is in /etc/group." - echo - echo "The /etc/passwd (and possibly /etc/group) files should be rebuilt." - echo "See the man pages for mkpasswd and mkgroup then, for example, run" - echo - echo "mkpasswd -l [-d] > /etc/passwd" - echo "mkgroup -l [-d] > /etc/group" - echo - echo "Note that the -d switch is necessary for domain users." - ;; -mkgroup ) - echo "Your group is currently \"mkgroup\". This indicates that neither" - echo "your gid nor your pgsid (primary group associated with your SID)" - echo "is in /etc/group." - echo - echo "The /etc/group (and possibly /etc/passwd) files should be rebuilt." - echo "See the man pages for mkpasswd and mkgroup then, for example, run" - echo - echo "mkpasswd -l [-d] > /etc/passwd" - echo "mkgroup -l [-d] > /etc/group" - echo - echo "Note that the -d switch is necessary for domain users." - ;; -esac - - - -if [ "$MAYBE_FIRST_START" = "true" ]; then - sh /usr/sbin/regen-info.sh - - if [ -f "/usr/bin/update-ca-trust" ] - then - sh /usr/bin/update-ca-trust - fi - - if [ -f "/usr/bin/xmlcatalog" ] - then - /usr/bin/mkdir -p /etc/xml - /usr/bin/xmlcatalog --noout --create /etc/xml/catalog - fi - - clear - echo - echo - echo "###################################################################" - echo "# #" - echo "# #" - echo "# C A U T I O N #" - echo "# #" - echo "# This is first start of MSYS2. #" - echo "# You MUST restart shell to apply necessary actions. #" - echo "# #" - echo "# #" - echo "###################################################################" - echo - echo -fi -unset MAYBE_FIRST_START -