mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 02:23:58 +00:00
Add r2pm -U to upgrade all the outdated packages
This commit is contained in:
parent
7c17f1cbbe
commit
d894f967e8
@ -22,7 +22,7 @@ export R2PM_JOBS=4
|
||||
export R2PMCACHE="$HOME/.r2pm.cache"
|
||||
|
||||
# Set R2_* Vars
|
||||
eval $(r2 -H)
|
||||
eval $(r2 -H 2> /dev/null)
|
||||
export R2_VERSION
|
||||
|
||||
R2PM=$0
|
||||
@ -72,7 +72,7 @@ export R2PM_USRPLUGIN_DIR="$R2_USER_PLUGINS"
|
||||
[ -z "${R2PM_PLUGDIR}" ] && R2PM_PLUGDIR="${R2DATAHOME}/plugins"
|
||||
|
||||
# www
|
||||
export R2PM_SYSWWWROOT="`r2 -qc 'e http.root' --`"
|
||||
export R2PM_SYSWWWROOT="`r2 -qc 'e http.root' -- 2> /dev/null`"
|
||||
export R2PM_HOMEWWWROOT="${R2DATAHOME}/www/"
|
||||
export R2PM_WWWROOT="${R2PM_HOMEWWWROOT}"
|
||||
|
||||
@ -128,6 +128,7 @@ Commands:
|
||||
-i,install <pkgname> install or update package in your home (pkgname=all)
|
||||
-gi,global-install <pkg> install or update package system-wide
|
||||
-gu,global-uninstall <pkg> uninstall pkg from systemdir
|
||||
-U,upgrade r2pm -U (upgrade all outdated plugins)
|
||||
-u,uninstall <pkgname> r2pm -u baleful (-uu to force)
|
||||
-l,list list installed pkgs
|
||||
-r,run [cmd ...args] run shell command with R2PM_BINDIR in PATH
|
||||
@ -144,7 +145,7 @@ Commands:
|
||||
init | update .. initialize/update database
|
||||
cd [git/dir] cd into given git (see 'r2pm ls')
|
||||
ls ls all cloned git repos in GITDIR
|
||||
suicide self remove all (home + system) installations of r2
|
||||
purge self destroy all r2 installations
|
||||
cache cache contents of r2 -H to make r2pm r2-independent
|
||||
Environment:
|
||||
SUDO=sudo use this tool as sudo
|
||||
@ -190,7 +191,7 @@ countDown() {
|
||||
echo 'Go!'
|
||||
}
|
||||
|
||||
commitSuicide() {
|
||||
thePurge() {
|
||||
confirm "Do you wanna purge r2 completely from your system and home?"
|
||||
if [ $? != 0 ]; then
|
||||
echo "Aborted." > /dev/stderr
|
||||
@ -212,6 +213,15 @@ commitSuicide() {
|
||||
unset IFS
|
||||
}
|
||||
|
||||
upgradeOutdated() {
|
||||
LINES=`r2 -qcq -- 2>&1 | grep r2pm | sed -e 's,$,;,g'`
|
||||
if [ -n "${LINES}" ]; then
|
||||
eval "${LINES}"
|
||||
else
|
||||
echo "Nothing to upgrade"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
init|up|update)
|
||||
[ -z "$R2PM_DBDIR" ] && R2PM_DBDIR="${R2PM_USRDIR}/db"
|
||||
@ -696,6 +706,9 @@ cache)
|
||||
echo "export PREFIX=\"${PREFIX}\"" >> "${R2PMCACHE}"
|
||||
echo "[r2pm] r2 environment cached in ${R2PMCACHE}"
|
||||
;;
|
||||
-U|upgrade)
|
||||
upgradeOutdated
|
||||
;;
|
||||
-a|add)
|
||||
if [ "$2" = "help" ]; then
|
||||
printf '%s\n' \
|
||||
@ -750,8 +763,8 @@ cache)
|
||||
fi
|
||||
eval echo "\$$2"
|
||||
;;
|
||||
suicide)
|
||||
commitSuicide
|
||||
purge)
|
||||
thePurge
|
||||
;;
|
||||
-d|doc|--doc)
|
||||
r2pm_doc "$2"
|
||||
|
@ -319,13 +319,13 @@ R_API int r_lib_open_ptr(RLib *lib, const char *file, void *handler, RLibStruct
|
||||
free (mm1);
|
||||
if (mismatch) {
|
||||
eprintf ("Module version mismatch %s (%s) vs (%s)\n",
|
||||
file, stru->version, R2_VERSION);
|
||||
if (stru->pkgname) {
|
||||
const char *dot = strchr (stru->version, '.');
|
||||
int major = atoi (stru->version);
|
||||
int minor = dot ? atoi (dot + 1) : 0;
|
||||
// The pkgname member was introduced in 4.2.0
|
||||
if (major > 4 || (major == 4 && minor >= 2)) {
|
||||
file, stru->version, R2_VERSION);
|
||||
const char *dot = strchr (stru->version, '.');
|
||||
int major = atoi (stru->version);
|
||||
int minor = dot ? atoi (dot + 1) : 0;
|
||||
// The pkgname member was introduced in 4.2.0
|
||||
if (major > 4 || (major == 4 && minor >= 2)) {
|
||||
if (stru->pkgname) {
|
||||
printf ("r2pm -ci %s\n", stru->pkgname);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ Install a package
|
||||
Install a package in the system directory
|
||||
.It Fl u, Cm uninstall Ar pkgname
|
||||
Uninstall a package
|
||||
.It Fl U, Cm Upgrade all the outdated packages
|
||||
Runs the suggested lines when loading outdated plugins by r2
|
||||
.It Fl gu, Cm global-install Ar pkgname
|
||||
Uninstall a package from the system directory
|
||||
.It Fl l, Cm list
|
||||
|
Loading…
Reference in New Issue
Block a user