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 if [ -z "$arg" ]; then
14 (conf) less ${HOME}/configure.err ;;
15 (install) less ${HOME}/install.err ;;
16 (check) less ${HOME}/check.err ;;
17 (make) less ${HOME}/make.err ;;
18 (upd) less ${HOME}/upd.err ;;
19 (ver) less ${HOME}/verupd.err ;;
20 (all) less ${HOME}/*.err ;;
27 if [ -z "$arg" ]; then
31 (conf) less ${HOME}/configure.log ;;
32 (install) less ${HOME}/install.log ;;
33 (check) less ${HOME}/check.log ;;
34 (make) less ${HOME}/make.log ;;
35 (upd) less ${HOME}/upd.log ;;
36 (ver) less ${HOME}/verupd.log ;;
37 (all) less ${HOME}/*.log ;;
44 if [ -z "$arg" ]; then
48 (conf) less ${HOME}/configure.{err,log} ;;
49 (install) less ${HOME}/install.{err,log} ;;
50 (check) less ${HOME}/check.{err,log} ;;
51 (make) less ${HOME}/make.{err,log} ;;
52 (upd) less ${HOME}/upd.{err,log} ;;
53 (ver) less ${HOME}/verupd.{err,log} ;;
54 (all) less ${HOME}/*.{err,log} ;;
61 if [ -z "$arg" ]; then
64 grep --colour=always '^\*\*\*' ${HOME}/install.${arg}|less
69 for log in configure make check install upd verupd; do
70 [[ -f ${HOME}/${log}.err ]] && rm -v ${HOME}/${log}.err
71 [[ -f ${HOME}/${log}.log ]] && rm -v ${HOME}/${log}.log
78 sed -i "s|\(Version: \).*$|\1${arg}|" ${HOME}/.project
79 echo -n "Version updated... "
80 grep --colour Version:.*$ ${HOME}/.project
85 local top=$(grep -n "^Install Notes:$" ${HOME}/.project|cut -d: -f1)
86 local bot=$(grep -n "^General Notes:$" ${HOME}/.project|cut -d: -f1)
87 sed -n ${top},${bot}p ${HOME}/.project|less
92 local top=$(grep -n "^General Notes:$" ${HOME}/.project|cut -d: -f1)
93 local bot=$(grep -n "^CONTENTS:$" ${HOME}/.project|cut -d: -f1)
94 sed -n ${top},${bot}p ${HOME}/.project|less
103 if [ -z "${fname}" ]; then
104 echo No filename specified >&2
108 type=$(file ${fname}|cut -d' ' -f2)
117 if lzmainfo ${fname} &>/dev/null; then
120 printf "Unknown file type: %s\n" $type >&2
135 if [ -z "${fname}" ]; then
136 echo No filename specified >&2
140 type=$(file ${fname}|cut -d' ' -f2)
144 (gzip) opts=ztvvvf ;;
145 (bzip2) opts=jtvvvf ;;
146 (xz|XZ) opts=Jtvvvf ;;
148 # lzma. Here because lzmainfo is too stupid
149 if lzmainfo ${fname} &>/dev/null; then
152 printf "Unknown file type: %s\n" $type >&2
158 tar ${opts} ${fname}|less
161 ## Check if there is a newer build script, maybe update.
162 # NOTE: Updating needs SXEmacs. It'll work in XEmacs and Emacs too,
163 # but you'll need to change build-update() accordingly.
166 if [ -x $(type -p sxemacs) ]; then
167 sxemacs -l /etc/pkgusr/bld-update.el
169 echo *** Sorry, you do not have SXEmacs installed.
170 echo *** Copying the new build script to ~/build-$(date +%Y%m%d)
171 cp -v /etc/pkgusr/skel-package/build \
172 ${HOME}/build-$(date +%Y%m%d)
178 local sysb=/etc/pkgusr/skel-package/build
179 local pkgb=${HOME}/build
180 local sysbv=$(${sysb} -V|awk '/build:/ {print $2;}')
181 local pkgbv=$(${pkgb} -V|awk '/build:/ {print $2;}')
183 if [ ${sysb} -nt ${pkgb} ]; then
184 echo '*****************************************'
186 echo '* B u i l d S c r i p t U p d a t e *'
187 echo '* A v a i l a b l e *'
189 echo '*****************************************'
190 echo ' Your version:' ${pkgbv}
191 echo ' Available Version:' ${sysbv}
193 echo 'For a SXEmacs based interactive update, run: "build-update"'
194 echo 'To turn this notice off, set $CHECKUPDATES to: "0"'
196 echo -n 'Press [RETURN] to continue...'
203 alias srepo='grep --colour Repo_Location:.*$ ${HOME}/.project'
204 alias rawrepo='srepo|cut -d" " -f2|tr -d "<>"'
205 alias trepo='grep --colour Repo_Type:.*$ ${HOME}/.project'
206 alias web='grep --colour Web_Site:.*$ ${HOME}/.project'
207 alias rawweb='web|tr -s " "|cut -d" " -f3|tr -d "<>"'
209 alias alogs='ls -l ${HOME}/*.{err,log}'
210 alias lerr='ls -l ${HOME}/*.err'
211 alias llog='ls -l ${HOME}/*.log'
213 alias ebld='nano -w ${HOME}/build'
214 alias epro='nano -w ${HOME}/.project'
215 alias ebp='nano -w ${HOME}/{build,.project}'
216 alias deps='grep --colour "Deps: " ${HOME}/.project'
219 alias listp='pinky -l $(whoami)|less'
227 alogs List of build logs (showing size)
228 lerr List just the error logs
229 llog List just the .log logs
230 verr [LOG] Display LOG, which can be:
231 \`conf' -- configure.err
232 \`check' -- check.err
233 \`install' -- install.err
237 \`all' -- all error logs (default)
238 vlog [LOG] Same as for \`verr', but for the .log files.
239 verrlog [LOG] Same as for \`verr', but displays both the .err,
241 dlog Removes all build logs
242 instg {err|log} Greps install.err (default) or install.log for
243 pkgusr notifications ("*** some message")
245 Package Notes/Content:
247 showinst Displays the \`Install Notes'. (alias: ipkg)
248 showgen Displays the \`General Notes'. (alias: gpkg)
249 listp Displays the entire package info (piped through less(1))
250 srepo Display the package's source repo location.
251 rawrepo Output just the repo URL (to use with lynx, curl, etc)
252 trepo Display the type of repo (tla, git, svn, mercurial etc)
253 web Display the package's homepage URL.
254 rawweb Output just the web URL (to use with lynx etc)
255 deps Display the package's dependencies
259 xtar [TARBALL] Extract TARBALL, automatically choosing the appropriate
261 vtar [TARBALL] List the contents of TARBALL, automatically choosing
262 appropriate options and piping through less(1).
266 ebld Edit the build script.
267 epro Edit the .project file.
268 ebp Edit the build script and the .project file.
269 updver [NEWVER] Updates the version in the .project. It MUST be
270 quoted to protect it from shell expansion.