FreeBSD Bugzilla – Attachment 198218 Details for
Bug 232315
[NEW PORT] shells/poshinit : portable way of using the same shell environment with Bash / Zsh across FreeBSD / Linux / Cygwin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Revised shar archive for poshinit
poshinit.shar (text/plain), 12.64 KB, created by
bourne.identity@hotmail.com
on 2018-10-16 15:34:21 UTC
(
hide
)
Description:
Revised shar archive for poshinit
Filename:
MIME Type:
Creator:
bourne.identity@hotmail.com
Created:
2018-10-16 15:34:21 UTC
Size:
12.64 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># shells/poshinit ># shells/poshinit/Makefile ># shells/poshinit/pkg-descr ># shells/poshinit/files ># shells/poshinit/files/poshinit ># shells/poshinit/files/poshinit.1.gz ># shells/poshinit/distinfo ># >echo c - shells/poshinit >mkdir -p shells/poshinit > /dev/null 2>&1 >echo x - shells/poshinit/Makefile >sed 's/^X//' >shells/poshinit/Makefile << '6478807b2a3d8dc27461825a16cce70d' >X# $FreeBSD$ >X >XPORTNAME=poshinit >XPORTVERSION=1.0 >XCATEGORIES=shells >XMASTER_SITES= >X >XMAINTAINER=bourne.identity@hotmail.com >XCOMMENT=Portable shell environment across Bash/Zsh & across FreeBSD/Linux/Cygwin >X >XNO_BUILD=yes >XNO_ARCH=yes >X >XPLIST_FILES=bin/${PORTNAME} man/man1/${PORTNAME}.1.gz >X >Xdo-install: >X ${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/ >X ${INSTALL_MAN} ${WRKDIR}/${PORTNAME}.1.gz ${STAGEDIR}${MANPREFIX}/man/man1 >X >X.include <bsd.port.mk> >6478807b2a3d8dc27461825a16cce70d >echo x - shells/poshinit/pkg-descr >sed 's/^X//' >shells/poshinit/pkg-descr << '2129c847ef038fffda5874a53c844d9d' >XYou want your shell stuff to work the same way even when you use a >Xdifferent shell, or even a different box. Right ? >X >XIf you use poshinit (Portable Shell Initialization), you can attain at >Xleast most of what you desire, perhaps even all. You can log out of Bash >Xand log in with Zsh (or vice versa) - and your aliases/exports/functions >Xwill continue to work as before. >X >XIt gets better - if someday you need to use a different box with a >Xdifferent OS, you can get your shell to work your 'normal' way in a >Xjiffy. Just save your $HOME/.shell directory on your primary box, and >Xpaste it over your second box's $HOME/.shell (after running poshinit >Xsetup script on the second box). The second box need not be the same >Xoperating system - poshinit works across FreeBSD / Linux / Cygwin. >2129c847ef038fffda5874a53c844d9d >echo c - shells/poshinit/files >mkdir -p shells/poshinit/files > /dev/null 2>&1 >echo x - shells/poshinit/files/poshinit >sed 's/^X//' >shells/poshinit/files/poshinit << 'dc2b66c0e9046aacdb87214597a61851' >X#!/bin/sh >X >Xeditor=vim >X >Xdie() >X{ >X [ $# -eq 0 ] && exit 1 >X >X [ $# -gt 1 ] && \ >X echo "error initiated at line $1 : >X $2" 1>&2 || \ >X echo "$1" 1>&2 >X >X exit 1 >X} >X >Xwhile [ $# -gt 0 ]; do >X case "$1" in >X --help) >X less /usr/local/share/poshinit/poshinit.help >X exit 0 >X ;; >X >X *) >X die $LINENO "Invalid arg : $1" >X ;; >X esac >Xdone >X >Xcd $HOME || { echo '`cd $HOME` failed. Aborting : - (' 1>&2; exit 1; } >X >Xecho 'I shall delete 3 globs under your $HOME : .bash* .zsh* .shell*' >Xecho 'If you are okay with that, press Enter. Else hit Ctrl+C to abort.' >Xread dummy >X >Xrm -rf .bash* .zsh* .shell* >X >Xok=false >X >Xwhile [ $ok = false ]; do >X echo "I am using $editor as your preferred text editor" >X echo "Is that okay with you ? (y/n):" >X >X read answer >X case "$answer" in >X y|Y|yes) >X ok=true >X ;; >X >X n|N|no) >X echo "Enter the command to use as editor" >X read editor >X ;; >X >X *) >X echo "I could not make any sense of that. Aborting" 1>&2 >X exit 1 >X ;; >X esac >Xdone >X >X[ -z "$editor" ] && { echo '$editor is null; aborting' 1>&2; exit 1; } >X >Xif ! which "$editor" > /dev/null; then >X echo 'Warning: bad `which $editor`' 1>&2 >X echo 'I am continuing with setup as such.' 1>&2 >X echo 'You can change your editor via ~/.shell/exports' 1>&2 >X read dummy >Xfi >X >Xset -e >Xclear >Xmkdir .shell >X >X{ >Xcat << 'EOF_aliases' >X# This file is meant for implementation-independent aliases. >X# Put implementation-specific aliases (eg: ls) in level_2/level_3 >X >Xalias p="cd .." >Xalias p2="cd ../.." >Xalias rf="rm -rf" >XEOF_aliases >X} > .shell/aliases >X >X{ >Xcat << 'EOF_exports' >X# This file is meant for implementation-independent exports. >X# Put implementation-specific exports in level_2/level_3 >X >Xexport PATH=$PATH:$HOME/bin >XEOF_exports >X} > .shell/exports >X >Xecho "export EDITOR=$editor" >> .shell/exports >X >X{ >Xcat << 'EOF_functions' >X# This file is meant for implementation-independent functions. >X# Put implementation-specific functions in level_2/level_3 >X >XEOF_functions >X} > .shell/functions >X >Xecho > .shell/uponlogin >X >Xecho '[ -e ~/.shell/level_1.all ] && source ~/.shell/level_1.all' > .shellrc >Xecho '[ -e ~/.shell/uponlogin ] && . ~/.shell/uponlogin' >> .shellrc >X >X{ >Xcat << 'EOF_bash' >XPS1='`pwd` <<: ' >XHISTFILE="$HOME/.bash_history" >X[ -e ~/.shellrc ] && source ~/.shellrc >XEOF_bash >X} > .bashrc >X >Xln .bashrc .bash_profile >X >X{ >Xcat << 'EOF_zsh' >XPROMPT='%d <<: ' >XHISTFILE="$HOME/.zhistory" >Xsetopt hist_ignore_all_dups >X >Xbindkey "\e[1~" beginning-of-line >Xbindkey "\e[4~" end-of-line >Xbindkey "\e[5~" beginning-of-history >Xbindkey "\e[6~" end-of-history >Xbindkey "\e[3~" delete-char >Xbindkey "\e[2~" quoted-insert >Xbindkey "\e[5C" forward-word >Xbindkey "\eOc" emacs-forward-word >Xbindkey "\e[5D" backward-word >Xbindkey "\eOd" emacs-backward-word >Xbindkey "\ee[C" forward-word >Xbindkey "\ee[D" backward-word >Xbindkey "\^H" backward-delete-word >Xbindkey "\e[8~" end-of-line >Xbindkey "\e[7~" beginning-of-line >Xbindkey "\eOH" beginning-of-line >Xbindkey "\eOF" end-of-line >Xbindkey '^i' expand-or-complete-prefix >Xbindkey "\e[H" beginning-of-line >Xbindkey "\e[F" end-of-line >X >X[ -e ~/.shellrc ] && source ~/.shellrc >XEOF_zsh >X} > .zshrc >X >X{ >Xcat << 'EOF1_all' >Xecho "$-" | grep -q 'i' || return >X >X[ -f ~/.shell/aliases ] && . ~/.shell/aliases >X[ -f ~/.shell/exports ] && . ~/.shell/exports >X[ -f ~/.shell/functions ] && . ~/.shell/functions >X >Xalias A="$EDITOR ~/.shell/aliases" >Xalias AA=". ~/.shell/aliases" >Xalias E="$EDITOR ~/.shell/exports" >Xalias EE=". ~/.shell/exports" >Xalias F="$EDITOR ~/.shell/functions" >Xalias FF=". ~/.shell/functions" >Xalias I="$EDITOR ~/.shell/uponlogin" >Xalias II=". ~/.shell/uponlogin" >Xalias L1="$EDITOR ~/.shell/level_1.all" >X >X# End of level_1 (Unix) global configuration. >X# All stuff below is for level_2, which branches for >X# freebsd / linux / cygwin : >X >Xif [ -L ~/.shell/level_2 ]; then >X for dist in freebsd linux cygwin; do >X if uname | grep -q -i $dist; then >X if ! readlink ~/.shell/level_2 | grep -q -i $dist; then >X if [ -f ~/.shell/level_2.${dist} ]; then >X cd ~/.shell >X ln -sf level_2.${dist} level_2 >X 1>/dev/null cd - >X else >X rm -f ~/.shell/level_2 >X fi >X fi >X >X break >X fi >X done >Xelse >X if ! [ -f ~/.shell/level_2 ]; then >X dist=`uname | tr '[:upper:]' '[:lower:]' | sed 's|_.*||'` >X >X if [ -f ~/.shell/level_2.${dist} ]; then >X cd ~/.shell >X ln -s level_2.${dist} level_2 >X 1>/dev/null cd - >X fi >X fi >Xfi >X >X[ -e ~/.shell/level_3 ] && rm -f ~/.shell/level_3 >X[ -e ~/.shell/level_2 ] && source ~/.shell/level_2 >X[ -e ~/.shell/level_2 ] && alias L2="$EDITOR ~/.shell/level_2" >XEOF1_all >X} > .shell/level_1.all >X >X{ >Xcat << 'EOF2_freebsd' >X# This file is meant for FreeBSD-specific definitions. >X# Put implementation-independent definitions in the files >X# [$HOME/.shell/]aliases|exports|functions >X >Xalias ls="ls -G" >Xalias pfind="pkg search" >Xalias pin="pkg install" >Xalias pls="pkg query %n" >XEOF2_freebsd >X} > .shell/level_2.freebsd >X >X{ >Xcat << 'EOF2_cygwin' >X# This file is meant for Cygwin-specific definitions. >X# Put implementation-independent definitions in the files >X# [$HOME/.shell/]aliases|exports|functions >X >Xalias ls="ls -1 --quoting-style=literal" >XEOF2_cygwin >X} > .shell/level_2.cygwin >X >X{ >Xcat << 'EOF2_linux' >X# This file is meant for Linux-specific definitions. >X# Put implementation-independent definitions in the files >X# [$HOME/.shell/]aliases|exports|functions >X >X# <distro-independent-definitions> >Xalias ls="ls -1 --quoting-style=literal" >X# </distro-independent-definitions> >X >X# End of distro-independent block. >X# All stuff below is for Level 3, which branches for distro flavours: >X# arch / debian / redhat >X >Xflavour="" >X >Xif [ -f /etc/arch-release ]; then >X flavour=arch >Xelif [ -f /etc/debian_version ]; then >X flavour=debian >Xelif [ -f /etc/redhat-release ]; then >X flavour=redhat >Xfi >X >X[ -n "$flavour" ] || return >X >Xif [ -L ~/.shell/level_3 ]; then >X if ! readlink ~/.shell/level_3 | grep -q -i $flavour; then >X if [ -f ~/.shell/level_3.${flavour} ]; then >X cd ~/.shell >X ln -sf level_3.${flavour} level_3 >X 1>/dev/null cd - >X else >X rm -f ~/.shell/level_3 >X fi >X fi >Xelse >X if ! [ -f ~/.shell/level_3 ]; then >X if [ -f ~/.shell/level_3.${flavour} ]; then >X cd ~/.shell >X ln -s level_3.${flavour} level_3 >X 1>/dev/null cd - >X fi >X fi >Xfi >X >X[ -e ~/.shell/level_3 ] && source ~/.shell/level_3 >X[ -e ~/.shell/level_3 ] && alias L3="$EDITOR ~/.shell/level_3" >XEOF2_linux >X} > .shell/level_2.linux >X >X{ >Xcat << 'EOF3_arch' >Xalias pfind="pacman -Ss" >Xalias pin="pacman -S" >Xalias pls="pacman --query" >XEOF3_arch >X} > .shell/level_3.arch >X >X{ >Xcat << 'EOF3_debian' >Xalias pfind="apt search" >Xalias pin="apt install" >Xalias pls="apt list --installed" >XEOF3_debian >X} > .shell/level_3.debian >X >X{ >Xcat << 'EOF3_redhat' >Xalias pfind="yum search" >Xalias pin="yum install" >Xalias pls="yum list installed" >XEOF3_redhat >X} > .shell/level_3.redhat >X >Xset +e >X >X{ >Xcat << 'EOF_final' >XI have created 3 kinds of aliases, as noted underneath. >X >XA) implementation-independent : | C) implementation-dependent : >X(under $HOME/.shell/aliases) | (under the highest possible level file) >Xalias p="cd .." | >Xalias p2="cd ../.." | c1)) For FreeBSD (under .shell/level_2) >Xalias rf="rm -rf" | alias ls="ls -G" >X | alias pfind="pkg search" >XB) poshinit-specific : | alias pin="pkg install" >X(under $HOME/.shell/level_1.all) | alias pls="pkg query %n" >Xalias A="$EDITOR ~/.shell/aliases" | >Xalias AA=". ~/.shell/aliases" | c2)) For Cygwin (under .shell/level_2) >Xalias E="$EDITOR ~/.shell/exports" | alias ls="ls -1 --quoting-style=literal" >Xalias EE=". ~/.shell/exports" | >Xalias F="$EDITOR ~/.shell/functions"| c3)) Linux (distro-independent -> level_2) >Xalias FF=". ~/.shell/functions" | alias ls="ls -1 --quoting-style=literal" >Xalias I="$EDITOR ~/.shell/uponlogin"| alias L3="$EDITOR ~/.shell/level_3" >Xalias II=". ~/.shell/uponlogin" | >Xalias L1="$EDITOR ~/.shell/level_1" | c4)) Linux (distro-dependent -> level_3) >Xalias L2="$EDITOR ~/.shell/level_2" | alias pfind="<search for package>" >X | alias pin="<install package>" >X | alias pls="<list installed package>" >X >XPortable shell initialization layout created successfully. >XTo have it take effect, logout and login again (or restart your terminal). >XThis complete message has been saved as $HOME/poshinit-msg.txt >XEOF_final >X} | tee poshinit-msg.txt >X >Xexit 0 >dc2b66c0e9046aacdb87214597a61851 >echo x - shells/poshinit/files/poshinit.1.gz >sed 's/^X//' >shells/poshinit/files/poshinit.1.gz << '0a8d6dbf88aee5c10e515e56f510e1d8' >X¾Æ[poshinit.1WmoÛ6þlþ1¬6`Ëu¼ C±vsV§õÐÆEbØ0 $:b#IÅq1ì·ïdù%Eû%ÉãÃ{îåá)ºy W0 þô'X%NÇÂÀÅÓéÏ}\âßRÛL*é¼]ÉoE±hý®ço¬ÙKë¿®WïÖËu»ÿÁ >XWÀ¡ÔÆñ8`3ç Ô½4ZB9pw°Ó$x À£eÜf¿m\¥õUîd@º;©nÁî¬ ÁârýròFªêaòûîv+Õ08÷r±þýýòÝÍru½÷OZô,Ñê^(Ilùô|ö¸ä8^ì2ü¢5ôÓ`,ðBÃN©lɨlµ¹tÐFKçwlCç9+ø'Ü^xràY ?ÂCzZ=Æ+bìÏæ:S)r³¶M,Ýá§Ê:HàNXo±¹ñãQcJÔ¢w£±Þ'Yàn.§±ºèï½0Á×BÙÊøCj (±aB¼c<øTPZ.%*6QÁsG,Ð@ªÏ:ùüÉá Od.D·¸~ç[ü=Heíi½8dû9nIe 9Ü©ÐñãF0¯ðf6" J¥èàÈÛOjä» Ì¹'ñ ã½Ô1ûÅd±@J%M5L®®¾2]`[¦EÍxåôX<¤Â¨h¹¾j<ºxOªR+¿ôËÉrIåssÕã¨üJÆï%< |3nÒPÝR±N£øè ?X¹îLT"¸Ä²Ð*{Ð3N¬Åµ2p+BÒ-GǺ&°ØvÁ_©0*ëÌ7ó`Ú 6CãPfÔm)¶HbmÇ= VS+H¥¨>ÐTj»X >X >XÊÍ.Tpîq)¸K//ú£w§ôµ&FSt¥rX±Hâ]è@Íf¡s©îл¦ÞûXM Í¢ØýgoNömÐîëì[r&©;.Û>óm¥]C±ÁÀÁµôÛ_É(pVäÔ Ñãé¨òuÔ±ÈõvÈÖQ ÖR¥sÜ%¿<¦{I$_»"Ö¹LbbY É?^xêáÿ/¡RÉY >XéNñB&(¸;à!ü¾Pî}[DlàÕµ}L¨ØïÐ)"|` ¶{.>+ÿÇh´¿ëÞn·½Ý®´ÝÚ®K¦ïàÖ÷z½ñÞ¯ÇËQâ]<YÞ Ø¦'ë9Ñ?ZÇEÜ$ÙÉb*bÉ/E¨øÔrÓæÔW½ÛµJÌï9!M Z¾ï*T`Äýsø 0¹àÔØøJ4²Ì!5FßãÁüyÿ»ÅËåÍêýèö½µÚE_´Xªów`¶8:cqu¨MüáÕÔYå°¶f`gmÞLÏ uêíÀöâQÛ»Ù£v³>ôÔ+þóM7|D Úüú9ÂêB¸,Pqj³E¤ìp\K¦Rz-ä 0q´ÏI={Õ"æ}`=Á/Cn÷sãq¢smÓÛágFÕÑèÊöÂ},NÊàïVOô(×whPìÎ hPå)ÐFo9¾0©ØHÄþÈWý4'ÑléÏÇøtQ¿H16öÞá«Ò Ðè©× {tò´<ØEÁìûNz; >X¡sº<þðUûÁ¨±Ô½z®õCW;XÇ'[÷'G½2çORÁz>«(]àÞ¾rêWàÙñ|Wwo^xWRì«>Ó2PøFo Ï ÿZ{-nåµ.|ô1ôì;~"¥KÕxÌ߬W4b¦õÕåWkv&quÛXÏ?ܼ^½go¹øðÇ8 pô18æKòÅÿ·L»%?BìUéå >0a8d6dbf88aee5c10e515e56f510e1d8 >echo x - shells/poshinit/distinfo >sed 's/^X//' >shells/poshinit/distinfo << 'ce674f5dd39fb7629c07239d6657c6f1' >XSHA256 (poshinit-1.0.tar.gz) = 74f416d2c67fae62751b54ae2561fa16110a9bd30183341afa039de83afca1ab >XSIZE (poshinit-1.0.tar.gz) = 4528 >ce674f5dd39fb7629c07239d6657c6f1 >exit >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 232315
:
198201
|
198202
|
198203
|
198216
|
198217
|
198218
|
198230
|
198231
|
198232
|
198245
|
198246
|
198247
|
198278
|
198279
|
198280
|
198282
|
198283
|
198284
|
198295
|
198296
|
198297
|
198321
|
198329
|
198625
|
198679
|
198705
|
198707
|
198772
|
198825
|
198870
|
198916
|
198995
|
198999
|
199152
|
199189
|
199343
|
199349
|
199424
|
199900
|
200615