Skip to content

Commit

Permalink
Finlize (fix bugs) new OSX package management.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrcad committed Oct 11, 2017
1 parent c78ccf3 commit f40ac03
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 60 deletions.
8 changes: 5 additions & 3 deletions adms/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand All @@ -10,9 +10,11 @@ prog=adms
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_$prog`
pkgs=$(pkgutil --pkgs | grep xictools_$prog)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/$prog

8 changes: 5 additions & 3 deletions fastcap/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand All @@ -10,9 +10,11 @@ prog=fastcap
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_$prog`
pkgs=$(pkgutil --pkgs | grep xictools_$prog)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/$prog

8 changes: 5 additions & 3 deletions fasthenry/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand All @@ -10,9 +10,11 @@ prog=fasthenry
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_$prog`
pkgs=$(pkgutil --pkgs | grep xictools_$prog)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/$prog

8 changes: 5 additions & 3 deletions mozy/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand All @@ -10,9 +10,11 @@ prog=mozy
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_$prog`
pkgs=$(pkgutil --pkgs | grep xictools_$prog)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/$prog

94 changes: 58 additions & 36 deletions mozy/src/help/help_pkgs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,21 @@
namespace {
void find_pkg(const char *prog, stringlist **l1, stringlist **l2)
{
while (*l1) {
// 9 == strlen*("xictools_")
if (lstring::prefix(prog, (*l1)->string + 9))
break;
*l1 = (*l1)->next;
if (l1) {
while (*l1) {
// 9 == strlen*("xictools_")
if (lstring::prefix(prog, (*l1)->string + 9))
break;
*l1 = (*l1)->next;
}
}
while (*l2) {
// 9 == strlen*("xictools_")
if (lstring::prefix(prog, (*l2)->string + 9))
break;
*l2 = (*l2)->next;
if (l2) {
while (*l2) {
// 9 == strlen*("xictools_")
if (lstring::prefix(prog, (*l2)->string + 9))
break;
*l2 = (*l2)->next;
}
}
}

Expand Down Expand Up @@ -149,13 +153,21 @@ pkgs::pkgs_page()
else {
lstr.add("<tr><td bgcolor=#f0fff0>");
}
lstr.add(locpkg->string);
if (locpkg)
lstr.add(locpkg->string);
else
lstr.add("not found");
lstr.add("</td><td>");
lstr.add(avlpkg->string);
if (avlpkg)
lstr.add(avlpkg->string);
else
lstr.add("not found");
lstr.add("</td><td>");
lstr.add("<center><input type=checkbox name=d_");
lstr.add(avlpkg->string);
lstr.add("></center>");
if (avlpkg) {
lstr.add("<center><input type=checkbox name=d_");
lstr.add(avlpkg->string);
lstr.add("></center>");
}
lstr.add("</td></tr>\n");
}
lstr.add("</table>\n");
Expand Down Expand Up @@ -229,6 +241,7 @@ namespace {
}


/* not used
char *get_version(const char *pkgname)
{
const char *t = strchr(pkgname, '-');
Expand All @@ -246,6 +259,7 @@ namespace {
n[len] = 0;
return (n);
}
*/


char *get_arch(const char *pkgname)
Expand Down Expand Up @@ -403,8 +417,11 @@ pkgs::local_pkgs()
FILE *fp = popen("pkgutil --pkgs | grep xictools", "r");
if (fp) {
char *s;
while ((s = fgets(buf, 256, fp)) != 0)
const char *vers = strchr(s, '-');
while ((s = fgets(buf, 256, fp)) != 0) {
char *e = s + strlen(s) - 1;
while (e >= s && isspace(*e))
*e-- = 0;
char *vers = strchr(s, '-');
if (vers) {
vers++;
char *v = lstring::copy(vers);
Expand All @@ -413,27 +430,29 @@ pkgs::local_pkgs()
}
else {
const char *ss = s + 9; // strlen("xictools_")
if (!strcmp(ss, "adms")
vers = "2.3.60";
else if (!strcmp(ss, "fastcap")
vers = "2.0.11";
else if (!strcmp(ss, "fasthenry")
vers = "2.0.12";
else if (!strcmp(ss, "mozy")
vers = "4.3.1";
else if (!strcmp(ss, "mrouter")
vers = "1.2.1";
else if (!strcmp(ss, "vl")
vers = "4.3.1";
else if (!strcmp(ss, "wrspice")
vers = "4.3.1";
else if (!strcmp(ss, "xic")
vers = "4.3.1";
const char *v = 0;
if (!strcmp("adms", ss))
v = "2.3.60";
else if (!strcmp("fastcap", ss))
v = "2.0.11";
else if (!strcmp("fasthenry", ss))
v = "3.0.12";
else if (!strcmp("mozy", ss))
v = "4.3.1";
else if (!strcmp("mrouter", ss))
v = "1.2.1";
else if (!strcmp("vl", ss))
v = "4.3.1";
else if (!strcmp("wrspice", ss))
v = "4.3.1";
else if (!strcmp("xic", ss))
v = "4.3.1";
else
continue; // WTF? can't happen
sprintf(s + strlen(s), "-Darwin-%s-x86_64", s, vers);
sprintf(s + strlen(s), "-Darwin-%s-x86_64", v);
}
list = new stringlist(lstring::copy(s), list);
}
if (list && list->next)
stringlist::sort(list);
fclose(fp);
Expand Down Expand Up @@ -475,7 +494,11 @@ pkgs::list_avail_pkgs()
}
else {
lstr.add("Sorry, prebuilt packages for ");
lstr.add(osname);
lstr.add(OSNAME);
if (strcmp(ARCH, "x86_64")) {
lstr.add_c('.');
lstr.add(ARCH);
}
lstr.add(" are not currently available.\n");
}
lstr.add("</blockquote>\n");
Expand Down Expand Up @@ -510,4 +533,3 @@ pkgs::list_cur_pkgs()
return (lstr.string_trim());
}


8 changes: 5 additions & 3 deletions mrouter/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand All @@ -10,9 +10,11 @@ prog=mrouter
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_$prog`
pkgs=$(pkgutil --pkgs | grep xictools_$prog)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/$prog

8 changes: 5 additions & 3 deletions vl/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand All @@ -10,9 +10,11 @@ prog=vl
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_$prog`
pkgs=$(pkgutil --pkgs | grep xictools_$prog)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/$prog

8 changes: 5 additions & 3 deletions wrspice/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand Down Expand Up @@ -27,9 +27,11 @@ fi
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_wrspice`
pkgs=$(pkgutil --pkgs | grep xictools_wrspice)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/wrspice.current

8 changes: 5 additions & 3 deletions xic/packages/osxpkg/resources/preinstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash
# $1 : the full path to the installation package
# $2 : the full path to the installation destination
# $3 : the mountpoint of the destination volume
Expand Down Expand Up @@ -29,9 +29,11 @@ fi
# Do a manual un-install if an existing package is found, Apple's
# install system apparently doesn't do this.

pkg=`pkgutil --pkgs : grep xictools_xic`
pkgs=$(pkgutil --pkgs | grep xictools_xic)
for a in $pkgs; do
pkgutil --forget $a
if [ ${a:0:9} = xictools_ ]; then
pkgutil --forget $a
fi
done
rm -rf $prefix/xictools/xic.current

0 comments on commit f40ac03

Please sign in to comment.