Fix problems with changing directories.

This commit is contained in:
Donald Ephraim Curtis 2011-12-13 21:15:15 -06:00
parent 63213c4501
commit b1d3db49df

25
melpa
View file

@ -1,63 +1,68 @@
#!/bin/bash #!/bin/bash
BASEDIR=`dirname $0` BASEDIR=`dirname $0`
function melpa_update_epkgs { function melpa_update_epkgs {
echo "Updating epkgs..." echo "Updating epkgs..."
pushd ${BASEDIR}/epkgs cd ${BASEDIR}/epkgs || return 1
git pull git pull
popd cd -
echo echo
} }
function melpa_clear_packages { function melpa_clear_packages {
echo "*** Clearing the packages folder..." echo "*** Clearing the packages folder..."
rm $BASEDIR/packages/* rm ${BASEDIR}/packages/*
echo echo
} }
function melpa_build_pkglist { function melpa_build_pkglist {
echo "*** Building all packages..." echo "*** Building all packages..."
pushd ${BASEDIR} cd ${BASEDIR} || return 1
for pkg in `cat pkglist`; do for pkg in `cat pkglist`; do
echo "Building package: $pkg" echo "Building package: $pkg"
./buildpkg $pkg ./buildpkg $pkg
echo echo
echo echo
done done
popd cd -
echo echo
} }
function melpa_build_archive { function melpa_build_archive {
echo "Building package: $pkg" echo "Building package: $pkg"
cd ${BASEDIR} || return 1
emacs --batch -l package-build.el -u dcurtis --eval "(package-build-archive \"$1\")" emacs --batch -l package-build.el -u dcurtis --eval "(package-build-archive \"$1\")"
cd -
echo echo
} }
function melpa_sync { function melpa_sync {
echo "*** Pushing changes to the server..." echo "*** Pushing changes to the server..."
cd ${BASEDIR} || return 1
rsync -avz --delete packages webpage/index.html milkbox.net:webapps/melpa/ rsync -avz --delete packages webpage/index.html milkbox.net:webapps/melpa/
cd -
echo echo
} }
function melpa_generate_html { function melpa_generate_html {
echo "*** Building webpage..." echo "*** Building webpage..."
pushd ${BASENAME}/webpage cd ${BASEDIR}/webpage || return 1
awk '{ if(/<!--list-of-packages-->/) awk '{ if(/<!--list-of-packages-->/)
while((getline < "../pkglist")>0) while((getline < "../pkglist")>0)
print "* " $0 print "* " $0
else print}' index.tmpl > index.md else print}' index.tmpl > index.md
pandoc -s --mathml -t html --smart index.md > index.html pandoc -s --mathml -t html --smart index.md > index.html
popd cd -
echo echo
} }
args=$@ args=$@
if [[ "$#" == "0" ]]; then if [[ "$#" == "0" ]]; then
args="update clear build html sync" args="update clear build index sync"
fi fi
for task in $args; do for task in $args; do
@ -65,8 +70,8 @@ for task in $args; do
update ) melpa_update_epkgs ;; update ) melpa_update_epkgs ;;
clear ) melpa_clear_packages ;; clear ) melpa_clear_packages ;;
build ) melpa_build_pkglist ;; build ) melpa_build_pkglist ;;
html ) melpa_generate_html ;; html | index ) melpa_generate_html ;;
sync ) melpa_sync ;; sync ) melpa_sync ;;
esac esac
shift shift
done done