2 # Copyright (C) 2007 - 2014 Steve Youngs <steve@sxemacs.org>
4 # What lies here is a collection of handy bash shell functions and
5 # aliases that make life a little easier for pkgusr.
10 local al=$(wc -l<${arg})
11 local sl=$(($LINES-2))
13 if [ $al -le $sl ]; then
23 if [ -z "$arg" ]; then
27 (conf) less-or-cat ${HOME}/configure.err ;;
28 (install) less-or-cat ${HOME}/install.err ;;
29 (check) less-or-cat ${HOME}/check.err ;;
30 (make) less-or-cat ${HOME}/make.err ;;
31 (upd) less-or-cat ${HOME}/upd.err ;;
32 (ver) less-or-cat ${HOME}/verupd.err ;;
33 (all) less ${HOME}/*.err ;;
40 if [ -z "$arg" ]; then
44 (conf) less-or-cat ${HOME}/configure.log ;;
45 (install) less-or-cat ${HOME}/install.log ;;
46 (check) less-or-cat ${HOME}/check.log ;;
47 (make) less-or-cat ${HOME}/make.log ;;
48 (upd) less-or-cat ${HOME}/upd.log ;;
49 (ver) less-or-cat ${HOME}/verupd.log ;;
50 (all) less ${HOME}/*.log ;;
57 if [ -z "$arg" ]; then
61 (conf) less ${HOME}/configure.{err,log} ;;
62 (install) less ${HOME}/install.{err,log} ;;
63 (check) less ${HOME}/check.{err,log} ;;
64 (make) less ${HOME}/make.{err,log} ;;
65 (upd) less ${HOME}/upd.{err,log} ;;
66 (ver) less ${HOME}/verupd.{err,log} ;;
67 (all) less ${HOME}/*.{err,log} ;;
74 if [ -z "$arg" ]; then
77 grep --color '^\*\*\*' ${HOME}/install.${arg}
82 for log in configure make check install upd verupd; do
83 [[ -f ${HOME}/${log}.err ]] && rm -v ${HOME}/${log}.err
84 [[ -f ${HOME}/${log}.log ]] && rm -v ${HOME}/${log}.log
91 sed -i "s|\(Version: \).*$|\1${arg}|" ${HOME}/.project
92 echo -n "Version updated... "
93 grep --colour Version:.*$ ${HOME}/.project
98 local top=$(grep -n "^Install Notes:$" ${HOME}/.project|cut -d: -f1)
99 local bot=$(grep -n "^General Notes:$" ${HOME}/.project|cut -d: -f1)
100 sed -n ${top},${bot}p ${HOME}/.project
105 local top=$(grep -n "^General Notes:$" ${HOME}/.project|cut -d: -f1)
106 local bot=$(grep -n "^CONTENTS:$" ${HOME}/.project|cut -d: -f1)
107 sed -n ${top},${bot}p ${HOME}/.project
116 if [ -z "${fname}" ]; then
117 echo No filename specified >&2
121 type=$(file ${fname}|cut -d' ' -f2)
130 if lzmainfo ${fname} &>/dev/null; then
133 printf "Unknown file type: %s\n" $type >&2
148 if [ -z "${fname}" ]; then
149 echo No filename specified >&2
153 type=$(file ${fname}|cut -d' ' -f2)
157 (gzip) opts=ztvvvf ;;
158 (bzip2) opts=jtvvvf ;;
159 (xz|XZ) opts=Jtvvvf ;;
161 # lzma. Here because lzmainfo is too stupid
162 if lzmainfo ${fname} &>/dev/null; then
165 printf "Unknown file type: %s\n" $type >&2
171 tar ${opts} ${fname}|less
174 ## Check if there is a newer build script, maybe update.
175 # NOTE: Updating needs SXEmacs. It'll work in XEmacs and Emacs too,
176 # but you'll need to change build-update() accordingly.
179 if [ -x $(type -p sxemacs) ]; then
180 sxemacs -l /etc/pkgusr/bld-update.el
182 echo *** Sorry, you do not have SXEmacs installed.
183 echo *** Copying the new build script to ~/build-$(date +%Y%m%d)
184 cp -v /etc/pkgusr/skel-package/build \
185 ${HOME}/build-$(date +%Y%m%d)
191 local sysb=/etc/pkgusr/skel-package/build
192 local pkgb=${HOME}/build
193 local sysbv=$(${sysb} -V|awk '/build:/ {print $2;}')
194 local pkgbv=$(${pkgb} -V|awk '/build:/ {print $2;}')
196 if [ ${sysb} -nt ${pkgb} ]; then
197 echo '*****************************************'
199 echo '* B u i l d S c r i p t U p d a t e *'
200 echo '* A v a i l a b l e *'
202 echo '*****************************************'
203 echo ' Your version:' ${pkgbv}
204 echo ' Available Version:' ${sysbv}
206 echo 'For a SXEmacs based interactive update, run: "build-update"'
207 echo 'To turn this notice off, set $CHECKUPDATES to: "0"'
209 echo -n 'Press [RETURN] to continue...'
216 alias srepo='grep --colour Repo_Location:.*$ ${HOME}/.project'
217 alias rawrepo='srepo|cut -d" " -f2|tr -d "<>"'
218 alias trepo='grep --colour Repo_Type:.*$ ${HOME}/.project'
219 alias web='grep --colour Web_Site:.*$ ${HOME}/.project'
220 alias rawweb='web|tr -s " "|cut -d" " -f3|tr -d "<>"'
222 alias alogs='ls -l ${HOME}/*.{err,log}'
223 alias lerr='ls -l ${HOME}/*.err'
224 alias llog='ls -l ${HOME}/*.log'
226 alias ebld='nano -w ${HOME}/build'
227 alias epro='nano -w ${HOME}/.project'
228 alias ebp='nano -w ${HOME}/{build,.project}'
229 alias deps='grep --colour "Deps: " ${HOME}/.project'
232 alias listp='pinky -l $(whoami)|less'
241 alogs List of build logs (showing size)
242 lerr List just the error logs
243 llog List just the .log logs
244 verr [LOG] Display LOG, which can be:
245 \`conf' -- configure.err
246 \`check' -- check.err
247 \`install' -- install.err
251 \`all' -- all error logs (default)
252 vlog [LOG] Same as for \`verr', but for the .log files.
253 verrlog [LOG] Same as for \`verr', but displays both the .err,
255 dlog Removes all build logs
256 instg {err|log} Greps install.err (default) or install.log for
257 pkgusr notifications ("*** some message")
259 Package Notes/Content:
261 showinst Displays the \`Install Notes'. (alias: ipkg)
262 showgen Displays the \`General Notes'. (alias: gpkg)
263 listp Displays the entire package info (piped through less(1))
264 srepo Display the package's source repo location.
265 rawrepo Output just the repo URL (to use with lynx, curl, etc)
266 trepo Display the type of repo (tla, git, svn, mercurial etc)
267 web Display the package's homepage URL.
268 rawweb Output just the web URL (to use with lynx etc)
269 deps Display the package's dependencies
273 xtar [TARBALL] Extract TARBALL, automatically choosing the appropriate
275 vtar [TARBALL] List the contents of TARBALL, automatically choosing
276 appropriate options and piping through less(1).
280 ebld Edit the build script.
281 epro Edit the .project file.
282 ebp Edit the build script and the .project file.
283 updver [NEWVER] Updates the version in the .project. It MUST be
284 quoted to protect it from shell expansion.