Imported from pacman-1.23.tar.gz
This commit is contained in:
parent
4c3842d42b
commit
20b7462293
10 changed files with 220 additions and 70 deletions
|
@ -1,11 +1,12 @@
|
||||||
VERSION DESCRIPTION
|
VERSION DESCRIPTION
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
|
1.23 - Added install/upgrade/remove scripting control
|
||||||
1.22 - Some manpage typo fixes
|
1.22 - Some manpage typo fixes
|
||||||
- Added --root switch to pacsync
|
- Added --root switch to pacsync
|
||||||
- Added --help and ability to specify a PKGBUILD to makepkg
|
- Added --help and ability to specify a PKGBUILD to makepkg
|
||||||
- Switched default downloader to snarf
|
- Switched default downloader to snarf
|
||||||
1.21 - Added better backup control -- upgrade/add and remove
|
1.21 - Added better backup control -- upgrade/add and remove
|
||||||
do different things with the -n switch
|
do different things with the -n switch
|
||||||
1.2 - Added wildcard handling
|
1.2 - Added wildcard handling
|
||||||
- Added man pages for makepkg and pacsync
|
- Added man pages for makepkg and pacsync
|
||||||
- Added the pacsync utility for remote file fetching/sync
|
- Added the pacsync utility for remote file fetching/sync
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -27,7 +27,7 @@ BINDIR = /usr/bin
|
||||||
MANDIR = /usr/man
|
MANDIR = /usr/man
|
||||||
ETCDIR = /etc
|
ETCDIR = /etc
|
||||||
|
|
||||||
VERSION = 1.22
|
VERSION = 1.23
|
||||||
LIBTAR_VERSION = 1.2.4
|
LIBTAR_VERSION = 1.2.4
|
||||||
|
|
||||||
CXX = gcc
|
CXX = gcc
|
||||||
|
|
8
makepkg
8
makepkg
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
myver='1.22'
|
myver='1.23'
|
||||||
startdir=`pwd`
|
startdir=`pwd`
|
||||||
|
|
||||||
[ -f /etc/makepkg.conf ] && . /etc/makepkg.conf
|
[ -f /etc/makepkg.conf ] && . /etc/makepkg.conf
|
||||||
|
@ -114,12 +114,6 @@ echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
|
||||||
for bakfile in "${backup[@]}"; do
|
for bakfile in "${backup[@]}"; do
|
||||||
echo "backup = $bakfile" >>.PKGINFO
|
echo "backup = $bakfile" >>.PKGINFO
|
||||||
done
|
done
|
||||||
if [ "$install" != "" ]; then
|
|
||||||
cat $startdir/$install | egrep '^[^$]' | sed 's/^/install = /g' >>.PKGINFO
|
|
||||||
fi
|
|
||||||
if [ "$remove" != "" ]; then
|
|
||||||
cat $startdir/$remove | egrep '^[^$]' | sed 's/^/remove = /g' >>.PKGINFO
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove info/doc files
|
# remove info/doc files
|
||||||
cd $startdir
|
cd $startdir
|
||||||
|
|
85
makepkg.8.in
85
makepkg.8.in
|
@ -73,7 +73,84 @@ this elsewhere, feel free to change it) like /usr/doc and /usr/info. It will
|
||||||
then strip debugging info from libraries and binaries and compress everything
|
then strip debugging info from libraries and binaries and compress everything
|
||||||
into a .pkg.tar.gz file in the directory you ran \fBmakepkg\fP from.
|
into a .pkg.tar.gz file in the directory you ran \fBmakepkg\fP from.
|
||||||
|
|
||||||
|
At this point you should have a package file in the current directory, named
|
||||||
|
something like name-version-release.pkg.tar.gz. Done!
|
||||||
|
|
||||||
|
.SH Install/Upgrade/Remove Scripting
|
||||||
|
Pacman has the ability to store and execute a package-specific script when it
|
||||||
|
installs, removes, or upgrades a package. This allows a package to "configure
|
||||||
|
itself" after installation and do the opposite right before it is removed.
|
||||||
|
|
||||||
|
The exact time the script is run varies with each operation:
|
||||||
|
.TP
|
||||||
|
.B post_install
|
||||||
|
script is run right after files are installed.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B post_upgrade
|
||||||
|
script is run after all files have been upgraded.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B pre_remove
|
||||||
|
script is run right before files are removed.
|
||||||
|
|
||||||
|
.RE
|
||||||
|
In order to use this feature, your build function should put the script in
|
||||||
|
$startdir/pkg/var/lib/pacman/scripts and it must be named exactly the same
|
||||||
|
as the \fI$pkgname\fP variable in the PKGBUILD script. For example, an
|
||||||
|
install script for grep will be $startdir/pkg/var/lib/pacman/scripts/grep.
|
||||||
|
Note that the scripts should be 644, not 755 (we don't need execute permission).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.TP
|
||||||
|
.SH Install scripts must follow this format:
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
# arg 1: the new package version
|
||||||
|
post_install() {
|
||||||
|
#
|
||||||
|
# do post-install stuff here
|
||||||
|
#
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg 1: the new package version
|
||||||
|
# arg 2: the old package version
|
||||||
|
post_upgrade() {
|
||||||
|
#
|
||||||
|
# do post-upgrade stuff here
|
||||||
|
#
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg 1: the old package version
|
||||||
|
pre_remove() {
|
||||||
|
#
|
||||||
|
# do pre-remove stuff here
|
||||||
|
#
|
||||||
|
}
|
||||||
|
|
||||||
|
op=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
$op $*
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
|
||||||
|
This template is also available in your ABS tree (/usr/abs/install.proto).
|
||||||
|
|
||||||
.SH PKGBUILD Directives
|
.SH PKGBUILD Directives
|
||||||
|
.TP
|
||||||
|
.B pkgname
|
||||||
|
The name of the package. This has be a unix-friendly name as it will be
|
||||||
|
used in the package filename.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B pkgver
|
||||||
|
This is the version of the software as released from the author (eg, 2.7.1).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B pkgrel
|
||||||
|
This is the release number specific to Arch Linux packages.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B backup
|
.B backup
|
||||||
A space-delimited array of filenames (without a preceding slash). The
|
A space-delimited array of filenames (without a preceding slash). The
|
||||||
|
@ -89,14 +166,6 @@ file, unless they have a fully-qualified URL. Then if the source file
|
||||||
does not already exist in /var/cache/pacman/src, the file is downloaded
|
does not already exist in /var/cache/pacman/src, the file is downloaded
|
||||||
by wget.
|
by wget.
|
||||||
|
|
||||||
.TP
|
|
||||||
.B install
|
|
||||||
There is also an \fIinstall\fP directive that is not used in the example
|
|
||||||
above. If \fIinstall\fP is set to the name of a file in the package build
|
|
||||||
directory, then it will be
|
|
||||||
copied to the package meta-info file and designated as a post-install script.
|
|
||||||
This will be run by pacman whenever it installs the package.
|
|
||||||
|
|
||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
Configuration options are stored in /etc/makepkg.conf. This file is parsed
|
Configuration options are stored in /etc/makepkg.conf. This file is parsed
|
||||||
as a bash script, so you can export any special compiler flags you wish
|
as a bash script, so you can export any special compiler flags you wish
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
toplevel=`pwd`
|
toplevel=`pwd`
|
||||||
version="1.22"
|
version="1.23"
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "makepkg version $version"
|
echo "makepkg version $version"
|
||||||
|
|
|
@ -17,12 +17,12 @@ into the installation root and the database will be updated.
|
||||||
.B "\-R, \-\-remove"
|
.B "\-R, \-\-remove"
|
||||||
Remove a package from the system. Files belonging to the
|
Remove a package from the system. Files belonging to the
|
||||||
specified package will be deleted, and the database will
|
specified package will be deleted, and the database will
|
||||||
be updated. Note that files with \fI.conf\fP extensions will
|
be updated. Note that most configuration files will be
|
||||||
be renamed with \fI.conf.save\fP extensions.
|
be renamed with \fI.pacsave\fP extensions.
|
||||||
.TP
|
.TP
|
||||||
.B "\-U, \-\-upgrade"
|
.B "\-U, \-\-upgrade"
|
||||||
Upgrade a package. This is essentially a "remove-then-install"
|
Upgrade a package. This is essentially a "remove-then-install"
|
||||||
process. Files with \fI.conf\fP extensions will be saved.
|
process. Most configuration files will be not be overwritten.
|
||||||
.TP
|
.TP
|
||||||
.B "\-Q, \-\-query"
|
.B "\-Q, \-\-query"
|
||||||
Query the package database. This operation allows you to
|
Query the package database. This operation allows you to
|
||||||
|
|
81
pacman.c
81
pacman.c
|
@ -79,10 +79,11 @@ static tartype_t gztype = {
|
||||||
* GLOBALS
|
* GLOBALS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
FILE* dbfp = NULL;
|
FILE* dbfp = NULL;
|
||||||
char* dbpath = PKGDB;
|
char* dbpath = NULL;
|
||||||
char* pkgname = NULL;
|
char* pkgname = NULL;
|
||||||
char* pkgver = NULL;
|
char* pkgver = NULL;
|
||||||
|
char oldpkgver[65];
|
||||||
|
|
||||||
char* pmo_root = NULL;
|
char* pmo_root = NULL;
|
||||||
unsigned short pmo_verbose = 0;
|
unsigned short pmo_verbose = 0;
|
||||||
|
@ -90,6 +91,7 @@ unsigned short pmo_force = 0;
|
||||||
unsigned short pmo_upgrade = 0;
|
unsigned short pmo_upgrade = 0;
|
||||||
unsigned short pmo_nosave = 0;
|
unsigned short pmo_nosave = 0;
|
||||||
unsigned short pmo_nofunc = 0;
|
unsigned short pmo_nofunc = 0;
|
||||||
|
unsigned short pmo_haveinst = 0;
|
||||||
unsigned short pmo_q_isfile = 0;
|
unsigned short pmo_q_isfile = 0;
|
||||||
unsigned short pmo_q_info = 0;
|
unsigned short pmo_q_info = 0;
|
||||||
unsigned short pmo_q_list = 0;
|
unsigned short pmo_q_list = 0;
|
||||||
|
@ -103,9 +105,6 @@ unsigned int pm_pkgcount = 0;
|
||||||
fileset_t pm_targets = NULL;
|
fileset_t pm_targets = NULL;
|
||||||
unsigned int pm_targct = 0;
|
unsigned int pm_targct = 0;
|
||||||
|
|
||||||
/* path to post-install script, if any */
|
|
||||||
char* pm_install = NULL;
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
pm_opfunc_t op_func;
|
pm_opfunc_t op_func;
|
||||||
|
@ -115,6 +114,10 @@ int main(int argc, char* argv[])
|
||||||
pmo_root = (char*)malloc(2);
|
pmo_root = (char*)malloc(2);
|
||||||
strcpy(pmo_root, "/");
|
strcpy(pmo_root, "/");
|
||||||
|
|
||||||
|
/* db location */
|
||||||
|
dbpath = (char*)malloc(strlen(PKGDIR)+strlen(PKGDB)+1);
|
||||||
|
sprintf(dbpath, "%s/%s", PKGDIR, PKGDB);
|
||||||
|
|
||||||
if(argc < 2) {
|
if(argc < 2) {
|
||||||
usage(PM_MAIN, (char*)basename(argv[0]));
|
usage(PM_MAIN, (char*)basename(argv[0]));
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -158,15 +161,14 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for db existence */
|
/* check for db existence */
|
||||||
if(pmo_root != NULL) {
|
if(pmo_root != NULL && strcmp(pmo_root, "/")) {
|
||||||
/* trim the trailing '/' if there is one */
|
/* trim the trailing '/' if there is one */
|
||||||
if((int)rindex(pmo_root, '/') == ((int)pmo_root)+strlen(pmo_root)-1) {
|
if((int)rindex(pmo_root, '/') == ((int)pmo_root)+strlen(pmo_root)-1) {
|
||||||
pmo_root[strlen(pmo_root)-1] = '\0';
|
pmo_root[strlen(pmo_root)-1] = '\0';
|
||||||
}
|
}
|
||||||
free(dbpath);
|
free(dbpath);
|
||||||
dbpath = (char*)malloc(strlen(pmo_root) + strlen(PKGDB) + 1);
|
dbpath = (char*)malloc(strlen(pmo_root)+strlen(PKGDIR)+strlen(PKGDB)+1);
|
||||||
strcpy(dbpath, pmo_root);
|
sprintf(dbpath, "%s%s/%s", pmo_root, PKGDIR, PKGDB);
|
||||||
dbpath = (char*)strcat(dbpath, PKGDB);
|
|
||||||
}
|
}
|
||||||
vprint("Using package DB: %s\n", dbpath);
|
vprint("Using package DB: %s\n", dbpath);
|
||||||
|
|
||||||
|
@ -185,6 +187,7 @@ int main(int argc, char* argv[])
|
||||||
/* start the requested operation */
|
/* start the requested operation */
|
||||||
if(!pmo_nofunc) {
|
if(!pmo_nofunc) {
|
||||||
for(i = 0; i < pm_targct; i++) {
|
for(i = 0; i < pm_targct; i++) {
|
||||||
|
pmo_haveinst = 0;
|
||||||
if(op_func(pm_targets[i])) {
|
if(op_func(pm_targets[i])) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
/*
|
/*
|
||||||
|
@ -205,7 +208,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if(op_func == pacman_remove) {
|
if(op_func == pacman_remove) {
|
||||||
/* the remove function no longer updates the db itself. we do it here
|
/* the remove function no longer updates the db itself. we do it here
|
||||||
* instead, in an effort to save some expensive file rewrites. note that we
|
* instead in an effort to save some expensive file rewrites. note that we
|
||||||
* can't do this for pacman_add() yet, as he's gotta call db_find_conflicts
|
* can't do this for pacman_add() yet, as he's gotta call db_find_conflicts
|
||||||
* for each package.
|
* for each package.
|
||||||
*/
|
*/
|
||||||
|
@ -219,9 +222,11 @@ int main(int argc, char* argv[])
|
||||||
int pacman_add(char* pkgfile)
|
int pacman_add(char* pkgfile)
|
||||||
{
|
{
|
||||||
int i, ret = 0, errors = 0;
|
int i, ret = 0, errors = 0;
|
||||||
TAR* tar;
|
TAR* tar = NULL;
|
||||||
char* errmsg = NULL;
|
char* errmsg = NULL;
|
||||||
char* expath = NULL;
|
char* expath = NULL;
|
||||||
|
char pm_install[PATH_MAX+1];
|
||||||
|
char cmdline[PATH_MAX+1];
|
||||||
/*char* newpath = NULL;*/
|
/*char* newpath = NULL;*/
|
||||||
fileset_t files = NULL;
|
fileset_t files = NULL;
|
||||||
unsigned int filecount = 0, nb = 0;
|
unsigned int filecount = 0, nb = 0;
|
||||||
|
@ -331,15 +336,19 @@ int pacman_add(char* pkgfile)
|
||||||
vprint("Done.\n");
|
vprint("Done.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run the script in pm_install */
|
/* run the post-install script if it exists */
|
||||||
if(pm_install != NULL) {
|
snprintf(pm_install, PATH_MAX, "%s%s/scripts/%s", pmo_root, PKGDIR, pkgname);
|
||||||
|
if(!stat(pm_install, &buf)) {
|
||||||
|
strcpy(oldpkgver, "");
|
||||||
|
for(i = 0; i < pm_pkgcount; i++) {
|
||||||
|
if(!strcmp(pm_packages[i]->name, pkgname)) {
|
||||||
|
strcpy(oldpkgver, pm_packages[i]->version);
|
||||||
|
}
|
||||||
|
}
|
||||||
vprint("Executing post-install script...\n");
|
vprint("Executing post-install script...\n");
|
||||||
expath = (char*)malloc(256);
|
snprintf(cmdline, PATH_MAX, "cd %s && /bin/sh %s post_%s %s %s", pmo_root, pm_install,
|
||||||
snprintf(expath, 255, "/bin/bash %s", pm_install);
|
(pmo_upgrade ? "upgrade" : "install"), pkgver, (pmo_upgrade ? oldpkgver : ""));
|
||||||
system(expath);
|
system(cmdline);
|
||||||
free(expath);
|
|
||||||
unlink(pm_install);
|
|
||||||
free(pm_install);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -350,6 +359,7 @@ int pacman_remove(char* pkgfile)
|
||||||
int found = 0, done = 0;
|
int found = 0, done = 0;
|
||||||
int i;
|
int i;
|
||||||
char line[PATH_MAX+1];
|
char line[PATH_MAX+1];
|
||||||
|
char pm_install[PATH_MAX+1];
|
||||||
fileset_t files = NULL;
|
fileset_t files = NULL;
|
||||||
unsigned int filecount = 0, nb = 0;
|
unsigned int filecount = 0, nb = 0;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
@ -367,7 +377,7 @@ int pacman_remove(char* pkgfile)
|
||||||
strcpy(line, trim(line));
|
strcpy(line, trim(line));
|
||||||
if(!strcmp(line, pkgfile)) {
|
if(!strcmp(line, pkgfile)) {
|
||||||
/* read the version */
|
/* read the version */
|
||||||
fgets(line, 63, dbfp);
|
fgets(oldpkgver, 63, dbfp);
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,6 +391,18 @@ int pacman_remove(char* pkgfile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!pmo_upgrade) {
|
||||||
|
/* run the pre-remove script if it exists */
|
||||||
|
snprintf(pm_install, PATH_MAX, "%s%s/scripts/%s", pmo_root, PKGDIR, pkgfile);
|
||||||
|
if(!stat(pm_install, &buf)) {
|
||||||
|
vprint("Executing pre-remove script...\n");
|
||||||
|
snprintf(line, PATH_MAX, "cd %s && /bin/sh %s pre_remove %s", pmo_root,
|
||||||
|
pm_install, oldpkgver);
|
||||||
|
|
||||||
|
system(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while(!done) {
|
while(!done) {
|
||||||
fgets(line, PATH_MAX, dbfp);
|
fgets(line, PATH_MAX, dbfp);
|
||||||
strcpy(line, trim(line));
|
strcpy(line, trim(line));
|
||||||
|
@ -921,19 +943,6 @@ int parse_descfile(char* descfile, unsigned short output, fileset_t *bakptr,
|
||||||
strcpy(pkgver, ptr);
|
strcpy(pkgver, ptr);
|
||||||
} else if(!strcmp(key, "PKGDESC")) {
|
} else if(!strcmp(key, "PKGDESC")) {
|
||||||
/* Not used yet */
|
/* Not used yet */
|
||||||
} else if(!strcmp(key, "INSTALL")) {
|
|
||||||
if(inst == NULL) {
|
|
||||||
pm_install = (char*)malloc(strlen("/tmp/pacman_XXXXXX")+1);
|
|
||||||
strcpy(pm_install, "/tmp/pacman_XXXXXX");
|
|
||||||
mkstemp(pm_install);
|
|
||||||
inst = fopen(pm_install, "w");
|
|
||||||
if(inst == NULL) {
|
|
||||||
perror("fopen");
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fputs(ptr, inst);
|
|
||||||
fputc('\n', inst);
|
|
||||||
} else if(!strcmp(key, "BACKUP")) {
|
} else if(!strcmp(key, "BACKUP")) {
|
||||||
backup = (fileset_t)realloc(backup, (++count) * sizeof(char*));
|
backup = (fileset_t)realloc(backup, (++count) * sizeof(char*));
|
||||||
backup[count-1] = (char*)malloc(strlen(ptr)+1);
|
backup[count-1] = (char*)malloc(strlen(ptr)+1);
|
||||||
|
@ -1016,6 +1025,8 @@ int parseargs(int op, int argc, char** argv)
|
||||||
pmo_nofunc = 1;
|
pmo_nofunc = 1;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
/* trim off the leading slash */
|
||||||
|
pmo_q_owns++;
|
||||||
} else if(!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) {
|
} else if(!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) {
|
||||||
/* PM_QUERY only */
|
/* PM_QUERY only */
|
||||||
pmo_q_list = 1;
|
pmo_q_list = 1;
|
||||||
|
|
5
pacman.h
5
pacman.h
|
@ -21,10 +21,11 @@
|
||||||
#ifndef PACMAN_H
|
#ifndef PACMAN_H
|
||||||
#define PACMAN_H
|
#define PACMAN_H
|
||||||
|
|
||||||
#define VERSION "1.22"
|
#define VERSION "1.23"
|
||||||
|
|
||||||
#define PKGEXT ".tar.gz"
|
#define PKGEXT ".tar.gz"
|
||||||
#define PKGDB "/var/lib/pacman/pacman.db"
|
#define PKGDIR "/var/lib/pacman"
|
||||||
|
#define PKGDB "pacman.db"
|
||||||
|
|
||||||
/* Operations */
|
/* Operations */
|
||||||
#define PM_MAIN 0
|
#define PM_MAIN 0
|
||||||
|
|
38
pacsync
38
pacsync
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
version="1.22"
|
version="1.23"
|
||||||
tanpath="/var/lib/pacman"
|
tanpath="/var/lib/pacman"
|
||||||
tandb="pacsync.db"
|
tandb="pacsync.db"
|
||||||
errors=0
|
errors=0
|
||||||
upgrade=0
|
upgrade=0
|
||||||
INSTALL_ROOT="/"
|
INSTALL_ROOT="/"
|
||||||
|
IGNORE_PKG=
|
||||||
|
|
||||||
message() {
|
message() {
|
||||||
echo "==> $1" >&2
|
echo "==> $1" >&2
|
||||||
|
@ -13,7 +14,7 @@ message() {
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "pacsync version $version"
|
echo "pacsync version $version"
|
||||||
echo "usage: $0 [--root <root>] <operation> [package]"
|
echo "usage: $0 [--root <root>] [--ignore <pkg>] <operation> [package]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "operations:"
|
echo "operations:"
|
||||||
echo " sync Download a fresh package list from the server"
|
echo " sync Download a fresh package list from the server"
|
||||||
|
@ -23,6 +24,11 @@ usage() {
|
||||||
echo " sysupgrade Same as \"report\", but actually do the upgrades"
|
echo " sysupgrade Same as \"report\", but actually do the upgrades"
|
||||||
echo " clean Removes all files from package cache to clear up diskspace"
|
echo " clean Removes all files from package cache to clear up diskspace"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "options:"
|
||||||
|
echo " --root <root> Set installation root to <root>"
|
||||||
|
echo " --ignore <pkg> Ignore packages that have <pkg> in their names when doing"
|
||||||
|
echo " sysupgrades. (--ignore can be used multiple times)"
|
||||||
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
checkdb() {
|
checkdb() {
|
||||||
|
@ -37,6 +43,10 @@ download() {
|
||||||
shift
|
shift
|
||||||
cl=
|
cl=
|
||||||
for file in $*; do
|
for file in $*; do
|
||||||
|
# snarf returns a nonzero error code when the file already exists, which
|
||||||
|
# confuses pacsync, so for now, no resume action...
|
||||||
|
rm -f $file
|
||||||
|
|
||||||
cl="$cl $SYNC_SERVER/$file"
|
cl="$cl $SYNC_SERVER/$file"
|
||||||
done
|
done
|
||||||
message "Downloading $targ"
|
message "Downloading $targ"
|
||||||
|
@ -49,13 +59,12 @@ download() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dosync() {
|
dosync() {
|
||||||
cd /tmp
|
|
||||||
download "package list" pacsync/$tandb
|
download "package list" pacsync/$tandb
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm -f $INSTALL_ROOT/$tanpath/$tandb
|
rm -f $INSTALL_ROOT/$tanpath/$tandb
|
||||||
mv /tmp/$tandb $INSTALL_ROOT/$tanpath/$tandb
|
mv $tandb $INSTALL_ROOT/$tanpath/$tandb
|
||||||
message "Done."
|
message "Done."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +176,7 @@ doreport() {
|
||||||
headers=0
|
headers=0
|
||||||
newkernel=0
|
newkernel=0
|
||||||
pkg2up=
|
pkg2up=
|
||||||
for pkgfile in `cat $INTALL_ROOT/$tanpath/$tandb | sed "s|^[a-z]*/||g"`; do
|
for pkgfile in `cat $INSTALL_ROOT/$tanpath/$tandb | sed "s|^[a-z]*/||g"`; do
|
||||||
pkgname=`echo $pkgfile | sed 's|-[a-zA-Z0-9\.]*-[0-9]*\.pkg\.tar\.gz||g'`
|
pkgname=`echo $pkgfile | sed 's|-[a-zA-Z0-9\.]*-[0-9]*\.pkg\.tar\.gz||g'`
|
||||||
pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null`
|
pacman=`pacman -Q -r $INSTALL_ROOT $pkgname 2>/dev/null`
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
|
@ -183,9 +192,16 @@ doreport() {
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
if [ `echo "$locfile" | egrep '^kernel-[a-zA-Z0-9\.]+-[0-9]+$'` ]; then
|
if [ `echo "$locfile" | egrep '^kernel-[a-zA-Z0-9\.]+-[0-9]+$'` ]; then
|
||||||
|
# this is the kernel pacakge -- we handle this one specially
|
||||||
newkernel=1
|
newkernel=1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
if [ "$IGNORE_PKG" != "" ]; then
|
||||||
|
if [ `echo "$locfile" | egrep "$IGNORE_PKG"` ]; then
|
||||||
|
# ignore this package as per user's request
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if [ "$headers" = "0" ]; then
|
if [ "$headers" = "0" ]; then
|
||||||
echo "+--------------------------------------+--------------------------------------+"
|
echo "+--------------------------------------+--------------------------------------+"
|
||||||
echo "| LOCAL | REMOTE |"
|
echo "| LOCAL | REMOTE |"
|
||||||
|
@ -227,6 +243,8 @@ doreport() {
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -238,6 +256,16 @@ if [ "$1" = "--root" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
while [ "$1" = "--ignore" ]; do
|
||||||
|
shift
|
||||||
|
if [ "$IGNORE_PKG" = "" ]; then
|
||||||
|
IGNORE_PKG="$1"
|
||||||
|
else
|
||||||
|
IGNORE_PKG="$IGNORE_PKG|$1"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
if [ -f /etc/pacsync.conf ]; then
|
if [ -f /etc/pacsync.conf ]; then
|
||||||
. /etc/pacsync.conf
|
. /etc/pacsync.conf
|
||||||
else
|
else
|
||||||
|
|
56
pacsync.conf
56
pacsync.conf
|
@ -1,12 +1,58 @@
|
||||||
#
|
#
|
||||||
# /etc/pacsync.conf
|
# /etc/pacsync.conf
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# From here you can configure pacsync to follow a certain package tree.
|
||||||
|
# Typically this is either 'stable' or 'current', but you can pick
|
||||||
|
# specific versions as well (eg, '0.2'). Read below for the structure.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Arch Linux servers follow this directory structure:
|
||||||
|
#
|
||||||
|
# 0.1
|
||||||
|
# |- iso
|
||||||
|
# | |- i686
|
||||||
|
# |- os
|
||||||
|
# | |- i686
|
||||||
|
# 0.2
|
||||||
|
# |- iso
|
||||||
|
# | |- i686
|
||||||
|
# |- os
|
||||||
|
# | |- i686
|
||||||
|
# 0.3
|
||||||
|
# |- iso
|
||||||
|
# | |- i686
|
||||||
|
# |- os
|
||||||
|
# | |- i686
|
||||||
|
# current -> 0.3/os/i686
|
||||||
|
# stable -> 0.2/os/i686
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Set your SYNC_SERVER according to the version you wish to follow. For
|
||||||
|
# example, if you simply wish to follow the stable branch (whatever version
|
||||||
|
# it may be), then you can set SYNC_SERVER as follows:
|
||||||
|
#
|
||||||
|
# SYNC_SERVER="ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/stable"
|
||||||
|
#
|
||||||
|
# Other examples:
|
||||||
|
# SYNC_SERVER="ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/0.2/os/i686"
|
||||||
|
# SYNC_SERVER="ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/0.3/os/i686"
|
||||||
|
# SYNC_SERVER="ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/current"
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# the full URL of the server (up to the /arch package directory)
|
# SYNC_SERVER: the full location of the package repository (ftp or http)
|
||||||
#
|
#
|
||||||
# (note: ibiblio.org will be fastest; please use it)
|
SYNC_SERVER="ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/current"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
SYNC_SERVER="ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/arch"
|
# OTHER LOCATIONS (MIRRORS)
|
||||||
#SYNC_SERVER="http://www.ibiblio.org/pub/linux/distributions/archlinux/arch"
|
#
|
||||||
#SYNC_SERVER="ftp://ftp.archlinux.org/arch"
|
# Note: ibiblio.org will typically be fastest. Please stick with them unless
|
||||||
|
# you've got a good reason to change.
|
||||||
|
#
|
||||||
|
#SYNC_SERVER="http://www.ibiblio.org/pub/linux/distributions/archlinux/current"
|
||||||
|
#SYNC_SERVER="ftp://ftp2.archlinux.org/current"
|
||||||
|
#SYNC_SERVER="ftp://ftp.archlinux.org/current"
|
||||||
|
|
Loading…
Add table
Reference in a new issue