Comments (8)
from update4j.
Hello, thanks for your kind words.
In a typical case where a single client hasn't updated across a few versions the solution is simply to use it cached (offline) version of their current config as the delete source.
The deleteOldFiles wasn't designed to delete arbitrary files, but instead focuses on files left over from old versions. Being that the user did not update, those middle version files aren't even present there.
Is there a case where this doesn't work for you?
from update4j.
Do you have a code example for using the cached offline version of their config file? That would pretty much do what I would like it to :)
Deletion of other, unknown files would only be a plus point, which is not that important right now
from update4j.
The default bootstrap does just this
update4j/src/main/java/org/update4j/service/DefaultBootstrap.java
Lines 235 to 254 in ff904b9
In general, you would want to have the config saved locally so if the user is offline they can still start the application. Unless if you only use update4j for updating and not for launching, in which case caching isn't important at all.
from update4j.
Thank you again for your help!
Unfortunately, I am not able to locate the config.old file on my system.
This is what I am doing right now, I added some code from the DefaultBootstrap. Any Idea why there is no config.old file?
InputStreamReader in = new InputStreamReader(connection.getInputStream());
Configuration config = Configuration.read(in);
if (config.requiresUpdate()) {
Path path = Paths.get(System.getProperty("user.home") + "/update.zip");
ArchiveUpdateOptions archiveOptions = UpdateOptions.archive(path);
config.update(archiveOptions);
Archive archive = Archive.read(System.getProperty("user.home") + "/update.zip");
Configuration oldConfig = null;
try (FileSystem fs = archive.openConnection()) {
Path oldPath = fs.getPath("config.old");
if (Files.exists(oldPath)) {
try (BufferedReader in2 = Files.newBufferedReader(oldPath)) {
oldConfig = Configuration.read(in2);
}
}
}
archive.install();
config.deleteOldFiles(oldConfig);
}
config.launch();
from update4j.
This isn't part of the default archive format, but added by the default bootstrap
This was left as part of userland setup being unopinionated where and how to keep configs between updates.
from update4j.
facepalm
So basically after the first update the local config is created. For all further updates, the config is read and updated.
Thank you so much! Hopefuly I won't have to bother you again for some time ;)
from update4j.
Glad I could help!
from update4j.
Related Issues (20)
- Permission Issue: Default Bootstrap Archive Location HOT 9
- Updating app's JDK with update4j HOT 5
- Make update.zip path confgurable HOT 1
- getOldFiles takes a long time (too long?) HOT 22
- Basic issue of understanding HOT 25
- Working in offline mode with --local and --syncLocal HOT 3
- Communication between bootstrap and business application HOT 4
- config.update does not download anything and just stop the programs HOT 2
- Headless Setup with NGINX Basic Auth HOT 13
- proposal HOT 1
- NoSuchFileException reserved/config when there is nothing to update HOT 3
- Demo App doesn't run on Windows 11 and Java 19 HOT 4
- Connect/read timeouts too short on URLConnection HOT 1
- Propagating business applications' exit code through Bootstrap HOT 5
- Error running an SWT application HOT 8
- Support multiple architectures HOT 19
- Exception when download files. HOT 2
- Relative path in basePath? HOT 3
- Size of file does not match size in configuration HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from update4j.