2 ## package-update.sh -- Create a package archive from the elpa repository
4 ## Usage: ./package-update.sh DEST [FULL-UPDATE]
6 ## This creates a package archive beginning in DEST.
8 ## The package archive itself is created in DEST/packages. This dir
9 ## contains the package files and the `archive-contents' listing file.
11 ## If a second argument FULL-UPDATE is specified (whatever its value),
12 ## also create the following:
13 ## - the archive admin scripts in DEST/admin
14 ## - a tarball contianing the entire archive in
15 ## DEST/packages/emacs-packages-latest.tgz
16 ## - the Org mode daily package
18 PATH
=/bin
:/usr
/bin
:/usr
/local
/bin
26 PKGROOT
=$DEST/packages
27 TMP_PKGROOT
=$DEST/packages-new
28 REPO_PACKAGES
=packages
32 echo "Syntax: $0 HOMEDIR [fetch-extras-boolean]"
34 elif [ -d $DEST ]; then
35 echo "Installing into '$DEST', log is '$LOG'"
36 echo "Installing into '$DEST'" > $LOG
38 echo "Base archive update only (pass second arg for full update)."
40 echo "Performing full archive update."
41 TARBALL
=$PKGROOT/emacs-packages-latest.tgz
42 TARBALL_ROOT
="emacs-24.1-packages-`/bin/date +'%F'`"
47 echo "Sorry but $DEST is not a directory, aborting."
51 ## Change to the bzr root directory
53 REPO_ROOT_DIR
=`$BZR root`;
54 if [ -z $REPO_ROOT_DIR ]; then
55 "This script should be run from a bzr repository, aborting."
61 ## Create the working directory that will be the world-facing copy of
62 ## the package archive base.
63 echo "Exporting packages to temporary working directory $TMP_PKGROOT" >> $LOG
65 $BZR export $TMP_PKGROOT $REPO_PACKAGES
67 ## Call the `make-package-archive' Lisp function.
69 ## If second arg is provided, copy in the admin directory and run the
70 ## Org daily synch scripts
72 echo "Skipping admin directory" >> $LOG
73 echo "Skipping post-export fetchers" >> $LOG
75 echo "Exporting admin scripts to $ADMINROOT" >> $LOG
77 $BZR export $ADMINROOT $REPO_ADMIN
78 echo "Running post-export org-mode fetcher as '$ADMINROOT/org-synch.sh $TMP_PKGROOT $ADMINROOT'" >> $LOG
79 $ADMINROOT/org-synch.sh
$TMP_PKGROOT $ADMINROOT >> $LOG 2>&1
82 ## Tar up the multi-file packages.
83 echo "Creating multi-file package tarballs in $TMP_PKGROOT" >> $LOG
87 if [ -f $pt/README
]; then
88 cp $pt/README
$pt-readme.txt
;
90 echo "Creating tarball $TMP_PKGROOT/$pt.tar" >> $LOG
91 tar -cf $pt.
tar $pt --remove-files
95 ## Move the working directory to its final location
96 echo "Moving $TMP_PKGROOT to $PKGROOT" >> $LOG
98 if [ -d $PKGROOT ]; then
99 mv $PKGROOT $PKGROOT-old
101 mv $TMP_PKGROOT $PKGROOT
104 ## If doing a full update, make a tarball of the entire archive.
105 if [ -z $FULL ]; then
106 echo "Skipping archive tarball" >> $LOG
108 echo "Exporting packages into $TARBALL (root = $TARBALL_ROOT)" >> $LOG
110 $BZR export --format=tgz
--root=$TARBALL_ROOT $TARBALL $REPO_PACKAGES
113 chmod -R a
+rX
$PKGROOT
114 echo "Update complete at" `/bin/date` >> $LOG