mirror of
https://github.com/adamyg/mcwin32.git
synced 2025-04-18 01:17:37 +03:00
autoupdater
This commit is contained in:
parent
599fe8e08b
commit
992b1a3f44
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "mcwin32/autoupdater/libappupdater"]
|
||||
path = mcwin32/autoupdater/libappupdater
|
||||
url = https://github.com/adamyg/libappupdater
|
@ -1,5 +1,4 @@
|
||||
.makelib
|
||||
WinSparkle-0.3
|
||||
include
|
||||
patch
|
||||
bin
|
||||
@ -27,4 +26,3 @@ mc.aps
|
||||
*.sav
|
||||
*.bak
|
||||
*.orig
|
||||
|
||||
|
2
mcwin32/.gitignore
vendored
2
mcwin32/.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
.makelib/
|
||||
WinSparkle-0.3/
|
||||
include/
|
||||
patch/
|
||||
bin/
|
||||
@ -31,4 +30,3 @@ wd*.bat
|
||||
*.bak
|
||||
*.orig
|
||||
|
||||
|
||||
|
@ -634,7 +634,8 @@ LIBRARIES=\
|
||||
$(LW)intl$(A) \
|
||||
$(LW)glib-2.0$(A) \
|
||||
$(LW)mcutil$(A) \
|
||||
$(LW)mcvfs$(A)
|
||||
$(LW)mcvfs$(A) \
|
||||
$(LW)autoupdater$(A)
|
||||
|
||||
reverse = $(if $1,$(call reverse,$(wordlist 2,999999,$1)) $(firstword $1))
|
||||
LDLIBRARIES = $(call reverse, $(LIBRARIES))
|
||||
@ -761,6 +762,7 @@ clean:
|
||||
$(MAKE) -C libregex clean
|
||||
$(MAKE) -C libz clean
|
||||
$(MAKE) -C libw32 clean
|
||||
$(MAKE) -C autoupdater clean
|
||||
-$(RM) $(MSGOBJS) $(MSGDIRS) >nul 2>&1
|
||||
-$(RM) $(DIRECTORIES) >nul 2>&1
|
||||
-$(RMDIR) $(dir $(DIRECTORIES) $(MSGDIRS)) >nul 2>&1
|
||||
@ -994,6 +996,10 @@ $(LW)intl$(A):
|
||||
$(LW)glib-2.0$(A):
|
||||
$(MAKE) -C libglib
|
||||
|
||||
.PHONY: $(LW)autoupdater$(A)
|
||||
$(LW)glib-2.0$(A):
|
||||
$(MAKE) -C autoupdater
|
||||
|
||||
|
||||
#########################################################################################
|
||||
# source rules
|
||||
|
2
mcwin32/autoupdater/.cvsignore
Normal file
2
mcwin32/autoupdater/.cvsignore
Normal file
@ -0,0 +1,2 @@
|
||||
libappupdater
|
||||
Makefile
|
211
mcwin32/autoupdater/Makefile.in
Normal file
211
mcwin32/autoupdater/Makefile.in
Normal file
@ -0,0 +1,211 @@
|
||||
# -*- mode: mak; indent-tabs-mode: t; tab-width: 8 -*-
|
||||
# $Id: Makefile.in,v 1.1 2021/08/14 09:31:30 cvsuser Exp $
|
||||
# libautoupdater and utils makefile
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
ROOT= @abs_top_builddir@
|
||||
top_builddir= @top_builddir@
|
||||
|
||||
# File extensions
|
||||
|
||||
E=
|
||||
O= .o
|
||||
A= .a
|
||||
LP= lib
|
||||
|
||||
CLEAN= *.bak *~ *.BAK *.swp *.tmp core *.core a.out
|
||||
XCLEAN=
|
||||
|
||||
# Compilers, programs
|
||||
|
||||
CC= @CC@
|
||||
CXX= @CXX@
|
||||
AR= @AR@
|
||||
RANLIB= @RANLIB@
|
||||
RM= @RM@
|
||||
PERL= @PERL@
|
||||
LIBTOOL= @LIBTOOL@
|
||||
RC= @RC@
|
||||
|
||||
# Configuration
|
||||
|
||||
ifeq ("$(BUILD_TYPE)","") #default
|
||||
BUILD_TYPE= debug
|
||||
MAKEFLAGS+= BUILD_TYPE=debug
|
||||
endif
|
||||
ifneq ("$(BUILD_TYPE)","release")
|
||||
RTSUFFIX=d
|
||||
endif
|
||||
|
||||
# Directories
|
||||
|
||||
D_INC= $(ROOT)/include
|
||||
D_BIN= $(ROOT)/bin@TOOLCHAINEXT@/$(BUILD_TYPE)
|
||||
D_OBJ= $(ROOT)/objects@TOOLCHAINEXT@/$(BUILD_TYPE)/libautoupdater
|
||||
D_LIB= $(ROOT)/lib@TOOLCHAINEXT@/$(BUILD_TYPE)
|
||||
|
||||
# Common flags
|
||||
|
||||
XFLAGS=
|
||||
CFLAGS= @CFLAGS@
|
||||
CWARN= @CWARN@ $(CWALL)
|
||||
CDEBUG= @CDEBUG@
|
||||
CRELEASE= @CRELEASE@
|
||||
CXXFLAGS= @CXXFLAGS@
|
||||
CXXDEBUG= @CXXDEBUG@
|
||||
ifeq ("$(CXXDEBUG)","")
|
||||
CXXDEBUG= $(CDEBUG)
|
||||
endif
|
||||
CXXRELEASE= @CXXRELEASE@
|
||||
ifeq ("$(CXXRELEASE)","")
|
||||
CXXRELEASE= $(CRELEASE)
|
||||
endif
|
||||
LDDEBUG= @LDDEBUG@
|
||||
LDRELEASE= @LDRELEASE@
|
||||
|
||||
CINCLUDE= -I$(D_INC) @CINCLUDE@
|
||||
CEXTRA= @DEFS@ @LIBCURL_CPPFLAGS@ -DLIBTRE_DLL
|
||||
ifdef PURIFY
|
||||
CEXTRA+= -DUSING_PURIFY
|
||||
endif
|
||||
ifeq ("win32","@build_os@")
|
||||
CEXTRA+= -DWIN32
|
||||
endif
|
||||
CDEPFLAGS= $(CEXTRA) $(CINCLUDE)
|
||||
|
||||
ifeq ("$(BUILD_TYPE)","release")
|
||||
CFLAGS+= $(CRELEASE) $(CWARN) $(CINCLUDE) $(CEXTRA) $(XFLAGS)
|
||||
CXXFLAGS+= $(CXXRELEASE) $(CWARN) $(CINCLUDE) @CXXINCLUDE@ $(CEXTRA) $(XFLAGS)
|
||||
LDFLAGS= $(LDRELEASE) @LDFLAGS@
|
||||
else
|
||||
CFLAGS+= $(CDEBUG) $(CWARN) $(CINCLUDE) $(CEXTRA) $(XFLAGS)
|
||||
CXXFLAGS+= $(CXXDEBUG) $(CWARN) $(CINCLUDE) @CXXINCLUDE@ $(CEXTRA) $(XFLAGS)
|
||||
LDFLAGS= $(LDDEBUG) @LDFLAGS@
|
||||
endif
|
||||
LDLIBS= -L$(D_LIB) @LIBS@ @EXTRALIBS@
|
||||
|
||||
YFLAGS= -d
|
||||
ARFLAGS= rcv
|
||||
RMFLAGS= -f
|
||||
RMDFLAGS= -rf
|
||||
|
||||
|
||||
#########################################################################################
|
||||
# Targets
|
||||
|
||||
UPDATERDLL= $(D_LIB)/$(LP)autoupdater.la
|
||||
UPDATERTSK= $(D_BIN)/mcupdater$(E)
|
||||
SIGNATURETSK= $(D_BIN)/mcsignature$(E)
|
||||
|
||||
UPDATERSRC= ./libappupdater
|
||||
ifeq ("wcl386","@CC@")
|
||||
EXPATSRC= ./libappupdater/compat
|
||||
else
|
||||
EXPATSRC= ./libappupdater/expat
|
||||
endif
|
||||
SIGNSRC= ./libappupdater/sign
|
||||
|
||||
VPATH= $(UPDATERSRC) $(UPDATERSRC)/src $(EXPATSRC) $(SIGNSRC) ./sign
|
||||
|
||||
DLLOBJS=\
|
||||
$(D_OBJ)/libautoupdater.lo \
|
||||
$(D_OBJ)/AutoConfig.lo \
|
||||
$(D_OBJ)/AutoConsole.lo \
|
||||
$(D_OBJ)/AutoDialog.lo \
|
||||
$(D_OBJ)/AutoDownload.lo \
|
||||
$(D_OBJ)/AutoError.lo \
|
||||
$(D_OBJ)/AutoLogger.lo \
|
||||
$(D_OBJ)/AutoManifest.lo \
|
||||
$(D_OBJ)/AutoUpdater.lo \
|
||||
$(D_OBJ)/AutoUpdater.res \
|
||||
$(D_OBJ)/AutoVersion.lo \
|
||||
\
|
||||
$(D_OBJ)/CProgressDialog.lo \
|
||||
$(D_OBJ)/CSimpleBrowser.lo \
|
||||
$(D_OBJ)/CUpdateInstallDlg.lo \
|
||||
$(D_OBJ)/CUpdatePromptDlg.lo \
|
||||
$(D_OBJ)/CUptodateDlg.lo \
|
||||
$(D_OBJ)/TProgressBar.lo \
|
||||
\
|
||||
$(D_OBJ)/xmlparse.lo \
|
||||
$(D_OBJ)/xmlrole.lo \
|
||||
$(D_OBJ)/xmltok.lo
|
||||
|
||||
UPDATEROBJS=\
|
||||
$(D_OBJ)/mcupdater$(O) \
|
||||
$(D_OBJ)/updater.res \
|
||||
$(D_OBJ)/getopt$(O)
|
||||
|
||||
SIGNATUREOBJS=\
|
||||
$(D_OBJ)/mcsignature$(O) \
|
||||
$(D_OBJ)/signature$(O) \
|
||||
$(D_OBJ)/getopt$(O)
|
||||
|
||||
OBJS= $(DLLOBJS) $(UPDATEROBJS) $(SIGNATUREOBJS)
|
||||
LIBS= $(UPDATERDLL)
|
||||
TSKS= $(UPDATERTSK) $(SIGNATURETSK)
|
||||
|
||||
|
||||
#########################################################################################
|
||||
# Rules
|
||||
|
||||
.PHONY: build release debug
|
||||
build: $(LIBS) $(TSKS)
|
||||
|
||||
release:
|
||||
$(MAKE) BUILD_TYPE=release $(filter-out release, $(MAKECMDGOALS))
|
||||
debug:
|
||||
$(MAKE) BUILD_TYPE=debug $(filter-out debug, $(MAKECMDGOALS))
|
||||
|
||||
$(UPDATERDLL): CEXTRA += -I$(UPDATERSRC) -I$(UPDATERSRC)/src -I$(EXPATSRC)
|
||||
$(UPDATERDLL): CEXTRA += -DXML_STATIC -DCOMPILED_FROM_DSP -D_CRT_SECURE_NO_DEPRECATE
|
||||
$(UPDATERDLL): CEXTRA += -DUNICODE -D_UNICODE
|
||||
$(UPDATERDLL): CEXTRA += -D_WIN32
|
||||
ifdef USE_DEBUG
|
||||
$(UPDATERDLL): CEXTRA += -D_DEBUG
|
||||
endif
|
||||
$(UPDATERDLL): CEXTRA += -DBUILDING_LIBAUTOUPDATER
|
||||
$(UPDATERDLL): $(D_OBJ)/.created $(DLLOBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(DLLOBJS) -version-number 1.0.1 \
|
||||
-rpath $(D_LIB) -bindir $(D_BIN) $(LDLIBS) version.lib wininet.lib advapi32.lib user32.lib
|
||||
|
||||
$(UPDATERTSK): CEXTRA += -I$(UPDATERSRC)
|
||||
$(UPDATERTSK): $(UPDATEROBJS)
|
||||
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(UPDATEROBJS) $(D_LIB)/libautoupdater$(A) $(LDLIBS) @LDMAPFILE@
|
||||
|
||||
$(SIGNATURETSK): CEXTRA += -I$(UPDATERSRC) -I$(SIGNSRC)
|
||||
$(SIGNATURETSK): $(SIGNATUREOBJS)
|
||||
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(SIGNATUREOBJS) $(D_LIB)/libautoupdater$(A) $(LDLIBS) @LDMAPFILE@
|
||||
|
||||
installinc: include/.created
|
||||
@echo publishing headers ...
|
||||
-cp $(UPDATERSRC)/magic.h include
|
||||
@echo publishing magicdb ...
|
||||
-cp magic.mgc $(D_BIN)
|
||||
|
||||
%/.created:
|
||||
-@mkdir $(@D)
|
||||
@echo "do not delete, managed directory" > $@
|
||||
|
||||
clean:
|
||||
-@$(RM) $(RMFLAGS) $(BAK) $(TSKS) $(LIBS) $(OBJS) $(CLEAN) $(XCLEAN) >/dev/null 2>&1
|
||||
|
||||
$(D_OBJ)/%$(O): %.cpp
|
||||
$(CC) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJ)/%$(O): %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJ)/%.lo: %.cpp
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJ)/%.lo: %.c
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJ)/%.res: %.rc
|
||||
$(RC) -Fo$@ -I./libappupdater/src $(RCDEFS) $<
|
||||
|
||||
#end
|
70
mcwin32/autoupdater/getopt.cpp
Normal file
70
mcwin32/autoupdater/getopt.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
// $Id: getopt.cpp,v 1.1 2021/08/14 09:31:30 cvsuser Exp $
|
||||
//
|
||||
// getopt() implementation
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
namespace Updater {
|
||||
|
||||
int optind = 1, /* index into parent argv vector */
|
||||
optopt; /* character checked for validity */
|
||||
const char *optarg; /* argument associated with option */
|
||||
|
||||
int
|
||||
Getopt(int nargc, char **nargv, const char *ostr)
|
||||
{
|
||||
#define OPTBADCH (int)'?'
|
||||
#define OPTEMSG ""
|
||||
#define OPTERR(s) \
|
||||
fputs(*nargv,stderr);fputs(s,stderr); \
|
||||
fputc(optopt,stderr);fputc('\n',stderr); \
|
||||
return(OPTBADCH);
|
||||
|
||||
static const char *place = OPTEMSG; /* option letter processing */
|
||||
const char *oli; /* option letter list index */
|
||||
|
||||
if (!*place) { /* update scanning pointer */
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) {
|
||||
return(EOF);
|
||||
}
|
||||
|
||||
if (*place == '-') { /* found "--" */
|
||||
++optind;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
/* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
!(oli = strchr(ostr,optopt))) {
|
||||
if (!*place) ++optind;
|
||||
OPTERR(": illegal option -- ");
|
||||
}
|
||||
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place) ++optind;
|
||||
|
||||
} else { /* need an argument */
|
||||
if (*place) optarg = place; /* no white space */
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = OPTEMSG;
|
||||
OPTERR(": option requires an argument -- ");
|
||||
|
||||
} else optarg = nargv[optind]; /* white space */
|
||||
place = OPTEMSG;
|
||||
++optind;
|
||||
}
|
||||
|
||||
#undef OPTBADCH
|
||||
#undef OPTEMSG
|
||||
#undef OPTERR
|
||||
|
||||
return(optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
} // namespace Updater
|
18
mcwin32/autoupdater/getopt.h
Normal file
18
mcwin32/autoupdater/getopt.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef UPGETOPT_H_INCLUDED
|
||||
#define UPGETOPT_H_INCLUDED
|
||||
// $Id: getopt.h,v 1.1 2021/08/14 09:31:31 cvsuser Exp $
|
||||
//
|
||||
// getopt() implementation
|
||||
//
|
||||
|
||||
namespace Updater {
|
||||
|
||||
extern int optind, /* index into parent argv vector */
|
||||
optopt; /* character checked for validity */
|
||||
extern const char *optarg; /* argument associated with option */
|
||||
|
||||
extern int Getopt(int nargc, char **nargv, const char *ostr);
|
||||
|
||||
} //namespace Updater
|
||||
|
||||
#endif /*UPGETOPT_H_INCLUDED*/
|
1
mcwin32/autoupdater/libappupdater
Submodule
1
mcwin32/autoupdater/libappupdater
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 6a8884b36c3c73bf5ccee030b63645af0e2d8a64
|
129
mcwin32/autoupdater/mcsignature.cpp
Normal file
129
mcwin32/autoupdater/mcsignature.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
// $Id: mcsignature.cpp,v 1.1 2021/08/14 09:31:31 cvsuser Exp $
|
||||
//
|
||||
// AutoUpdater: Manifest generation tool.
|
||||
//
|
||||
|
||||
#if !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <signature.h>
|
||||
|
||||
#include "../buildinfo.h"
|
||||
#include "getopt.h"
|
||||
|
||||
|
||||
static void Usage();
|
||||
static const char * Basename(const char *name);
|
||||
|
||||
static const char * x_progname;
|
||||
|
||||
|
||||
// Function: Main
|
||||
// Application entry.
|
||||
//
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const char *version = VERSION "." BUILD_NUMBER,
|
||||
*hosturl = "https://sourceforge.net/projects/mcwin32/files/mcwin32.manifest/download";
|
||||
int ch;
|
||||
|
||||
x_progname = Basename(argv[0]);
|
||||
while (-1 != (ch = Updater::Getopt(argc, argv, "V:H:h"))) {
|
||||
switch (ch) {
|
||||
case 'V': /* application version */
|
||||
version = Updater::optarg;
|
||||
break;
|
||||
case 'H': /* host URL template */
|
||||
hosturl = Updater::optarg;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
Usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argv += Updater::optind;
|
||||
if ((argc -= Updater::optind) < 1) {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": expected arguments <input> [<output>]" << std::endl;
|
||||
Usage();
|
||||
|
||||
} else if (argc > 2) {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": unexpected arguments '" << argv[2] << "' ..." << std::endl;
|
||||
Usage();
|
||||
}
|
||||
|
||||
const char *inputname = argv[0],
|
||||
*outputname = argv[1];
|
||||
size_t inputlen;
|
||||
|
||||
if ((inputlen = strlen(inputname)) < 5 || _stricmp(inputname + (inputlen-4), ".exe")) {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": <input> should reference an installer exe image\n";
|
||||
Usage();
|
||||
}
|
||||
|
||||
if (outputname && 0 == strcmp(inputname, outputname)) {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": <input> and <output> names must be different\n";
|
||||
Usage();
|
||||
}
|
||||
|
||||
sign_manifest(inputname, version, hosturl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Function: Usage
|
||||
// Echo the command line usage and exit.
|
||||
//
|
||||
// Parameters:
|
||||
// none
|
||||
//
|
||||
// Returns:
|
||||
// n/a
|
||||
//
|
||||
static void
|
||||
Usage()
|
||||
{
|
||||
std::cerr <<
|
||||
"\n"\
|
||||
"Autoupdater manifest signature generator version 1.01\n"\
|
||||
"\n"\
|
||||
" grsignature [options] <input> [<output>]\n"\
|
||||
"\n"\
|
||||
"Options:\n"\
|
||||
" -H <manifest> HostURL template.\n"\
|
||||
" -V <version> Version label.\n"\
|
||||
"\n"\
|
||||
"Arguments:\n"\
|
||||
" input Name of the input file.\n"\
|
||||
" output Optional name of the results output file.\n"\
|
||||
"\n" << std::endl;
|
||||
exit(3);
|
||||
}
|
||||
|
||||
|
||||
// Function: Basename
|
||||
// Retrieve the file basename from the specified file path.
|
||||
//
|
||||
//
|
||||
static const char *
|
||||
Basename(const char *filename)
|
||||
{
|
||||
const char *name;
|
||||
return (NULL != (name = strrchr(filename, '/')))
|
||||
|| (NULL != (name = strrchr(filename, '\\'))) ? name + 1 : filename;
|
||||
}
|
||||
|
||||
/*end*/
|
||||
|
153
mcwin32/autoupdater/mcupdater.cpp
Normal file
153
mcwin32/autoupdater/mcupdater.cpp
Normal file
@ -0,0 +1,153 @@
|
||||
// $Id: mcupdater.cpp,v 1.1 2021/08/14 09:31:31 cvsuser Exp $
|
||||
//
|
||||
// Midnight Commander AutoUpdater command line.
|
||||
//
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "../buildinfo.h"
|
||||
|
||||
#include "libautoupdater.h"
|
||||
#include "getopt.h"
|
||||
|
||||
static void Usage();
|
||||
static const char * Basename(const char *name);
|
||||
|
||||
static const char * x_progname;
|
||||
|
||||
|
||||
// Function: Main
|
||||
// Application entry.
|
||||
//
|
||||
// Returns:
|
||||
// 0 - No check performed.
|
||||
// 1 - Up-to-date.
|
||||
// 2 - Installed.
|
||||
// 3 - Update available.
|
||||
// 99 - Usage
|
||||
//
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const char *version = VERSION "." BUILD_NUMBER,
|
||||
*hosturl = "https://sourceforge.net/projects/mcwin32/files/mcwin32.manifest/download";
|
||||
int mode = 2, interactive = 0;
|
||||
int ch;
|
||||
|
||||
x_progname = Basename(argv[0]);
|
||||
while (-1 != (ch = Updater::Getopt(argc, argv, "V:H:ivh"))) {
|
||||
switch (ch) {
|
||||
case 'V': /* application version */
|
||||
version= Updater::optarg;
|
||||
break;
|
||||
case 'H': /* host URL */
|
||||
hosturl = Updater::optarg;
|
||||
break;
|
||||
case 'i': /* interactive */
|
||||
++interactive;
|
||||
break;
|
||||
case 'v': /* verbose */
|
||||
autoupdate_logger_stdout(1);
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
Usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argv += Updater::optind;
|
||||
if ((argc -= Updater::optind) < 1) {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": expected arguments <mode>" << std::endl;
|
||||
Usage();
|
||||
} else if (argc > 1) {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": unexpected arguments '" << argv[1] << "' ..." << std::endl;
|
||||
Usage();
|
||||
}
|
||||
|
||||
const char *arg = argv[0];
|
||||
|
||||
if (0 == _stricmp("disable", arg)) {
|
||||
mode = 0;
|
||||
} else if (0 == _stricmp("enable", arg)) {
|
||||
mode = 1;
|
||||
} else if (0 == _stricmp("auto", arg)) {
|
||||
mode = 2;
|
||||
} else if (0 == _stricmp("prompt", arg)) {
|
||||
mode = 3;
|
||||
} else if (0 == _stricmp("force", arg)) {
|
||||
mode = 4;
|
||||
} else if (0 == _stricmp("reinstall", arg)) {
|
||||
mode = 5;
|
||||
} else if (0 == _stricmp("reset", arg)) {
|
||||
mode = -1;
|
||||
} else if (0 == _stricmp("dump", arg)) {
|
||||
mode = -2;
|
||||
} else {
|
||||
std::cerr << "\n" <<
|
||||
x_progname << ": unknown mode '" << arg << "'" << std::endl;
|
||||
Usage();
|
||||
}
|
||||
|
||||
if (mode >= 1) {
|
||||
autoupdate_appversion_set(version);
|
||||
autoupdate_hosturl_set(hosturl);
|
||||
}
|
||||
|
||||
return autoupdate_execute(mode, interactive);
|
||||
}
|
||||
|
||||
|
||||
// Function: Usage
|
||||
// Echo the command line usage and exit.
|
||||
//
|
||||
// Parameters:
|
||||
// none
|
||||
//
|
||||
// Returns:
|
||||
// n/a
|
||||
//
|
||||
static void
|
||||
Usage()
|
||||
{
|
||||
std::cerr <<
|
||||
"\n"\
|
||||
"Midnight Commander updater version 1.01\n"\
|
||||
"\n"\
|
||||
" grupdater [options] mode\n"\
|
||||
"\n"\
|
||||
"Modes:\n"\
|
||||
" auto - Periodically check for updates.\n"\
|
||||
" prompt - Re-prompt user when periodic updates are disabled.\n"\
|
||||
" force - Unconditionally prompt, even when skipped.\n"\
|
||||
" reinstall - Prompt for install, even if uptodate.\n"\
|
||||
" enable - Enable periodic checks.\n"\
|
||||
" disable - Disable automatic periodic checks.\n"\
|
||||
" reset - Reset the updater status.\n"\
|
||||
"\n"\
|
||||
"Options:\n"\
|
||||
" -V <version> Version label.\n"\
|
||||
" -H <host> Host URL.\n"\
|
||||
" -i Interactive ('auto' only).\n"\
|
||||
" -v Verbose diagnostice.\n"\
|
||||
"\n" << std::endl;
|
||||
std::exit(99);
|
||||
}
|
||||
|
||||
|
||||
// Function: Basename
|
||||
// Retrieve the file basename from the specified file path.
|
||||
//
|
||||
static const char *
|
||||
Basename(const char *filename)
|
||||
{
|
||||
const char *name;
|
||||
return (NULL != (name = std::strrchr(filename, '/')))
|
||||
|| (NULL != (name = std::strrchr(filename, '\\'))) ? name + 1 : filename;
|
||||
}
|
||||
|
||||
/*end*/
|
99
mcwin32/autoupdater/updater.rc
Normal file
99
mcwin32/autoupdater/updater.rc
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* windows resource file; this file is part of the GRIEF.
|
||||
*/
|
||||
|
||||
#ifndef WINDRES
|
||||
#include "windows.h"
|
||||
#include "winver.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* English (U.S.) resources
|
||||
*/
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef WINDRES
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#endif
|
||||
#pragma code_page(1252)
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
* Manifest
|
||||
*/
|
||||
#ifndef RT_MANIFEST
|
||||
#define RT_MANIFEST 24
|
||||
#endif
|
||||
#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID
|
||||
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
|
||||
#endif
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "./libappupdater/manifest.xml"
|
||||
|
||||
/*
|
||||
* Updater Meta Data
|
||||
* nameID typeID { raw data }
|
||||
*/
|
||||
|
||||
UPDATER HostURL { "\0" }
|
||||
UPDATER Channel { "release\0" }
|
||||
|
||||
|
||||
/*
|
||||
* Version Information
|
||||
*/
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
#if defined(RC_FILEVERSION)
|
||||
FILEVERSION RC_FILEVERSION
|
||||
PRODUCTVERSION RC_PRODUCTVERSION
|
||||
#endif
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS (VS_FF_SPECIALBUILD|VS_FF_DEBUG)
|
||||
#else
|
||||
FILEFLAGS (VS_FF_SPECIALBUILD)
|
||||
#endif
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", ""
|
||||
VALUE "FileDescription", "GRIEF Editor, Auto Updater"
|
||||
#if defined(VERSION) && defined(BUILD_DATE)
|
||||
VALUE "FileVersion", VERSION ", Build:" BUILD_DATE "-" BUILD_NUMBER
|
||||
#endif
|
||||
VALUE "InternalName", "GRIEF"
|
||||
VALUE "Copyright",
|
||||
"Copyright (C) 2012 - 2021, Adam Young. All rights reserved. "
|
||||
"Licensed under the Grief License. "
|
||||
"This is free software; see the source for copying conditions. "
|
||||
"There is NO warranty; not even for MERCHANTABILITY "
|
||||
"or FITNESS FOR A PARTICULAR PURPOSE. "
|
||||
VALUE "Maintainers", "griefedit@gmail.com"
|
||||
VALUE "LegalTrademarks", "see GRIEF License"
|
||||
VALUE "OriginalFilename", "grupdater.exe"
|
||||
VALUE "ProductName", "GRIEF"
|
||||
END
|
||||
END
|
||||
|
||||
/* The following line should only be modified for localized versions. */
|
||||
/* It consists of any number of WORD,WORD pairs, with each pair */
|
||||
/* describing a language,codepage combination supported by the file. */
|
||||
/* */
|
||||
/* For example, a file might have values "0x409,1252" indicating that it */
|
||||
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
|
||||
#endif /* English (U.S.) resources */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: makelib.in,v 1.5 2021/04/13 16:00:16 cvsuser Exp $
|
||||
# $Id: makelib.in,v 1.6 2021/08/14 09:30:32 cvsuser Exp $
|
||||
# -*- mode: perl; tabs: 8; indent-width: 4; -*-
|
||||
# makelib configuration
|
||||
#
|
||||
@ -77,7 +77,8 @@ $PACKAGE_FILE = 'package.h';
|
||||
'libssh2',
|
||||
'libmagic',
|
||||
'libintl',
|
||||
'libglib'
|
||||
'libglib',
|
||||
'autoupdater'
|
||||
);
|
||||
|
||||
## Toolchain
|
||||
|
Loading…
x
Reference in New Issue
Block a user