Self-update from ~/restic sub directory

I downloaded restic 0.12.0 from the github page and placed it in ~/restic. I unpacked but didn’t move it to /usr/sbin. My question therefore is:

if I run restic self-update from ~/restic will it know where the file is and replace it in the same place or will it try and install under /usr/sbin?

Thanks in advance for all help.

I encourage you to simply try it and inspect the binary you have to see if it was replaced or not :wink:

It’s also described a bit here: Installation — restic 0.12.0 documentation

@rawtaz thanks very much for your response. The reason for my question is 2 fold:

  1. There currently isn’t a new version greater than 0.12.0 to try it on.

  2. The documentation that you suggested doesn’t directly answer my question.

I was hoping to set up a cron job that looked for updates once a month but in the absence of being able to test it I was hoping someone here would be able to answer my specific question.

The documentation says “Please be aware that the user executing the restic self-update command must have the permission to replace the restic binary. If you want to save the downloaded restic binary into a different file, pass the file name via the option --output.”

This tells you that 1) restic self-update will replace the current binary and 2) if you want to put it somewhere else, use the --output option (which indirectly means that if you don’t use this, it won’t be put somewhere else, hence it will be put in the same location).

1 Like

Thanks @rawtaz for your explanation. I have had very unfortunate experiences with software updates where if the installation was NOT originally in the default location then the system basically became inoperable when upgraded.

Hence my reticence to ‘assume’ anything. If you are now guaranteeing that the software will update insitu then I am very pleased to carry on with designing my cron job.

It’s always good to never assume anything. But one can do testing to investigate, that’s probably going to give you a more assuring view of it than trusting some folks on a random forum on the Internet ;-). Old versions of restic are available on the release page on GitHub.

I’m not making any guarantees, as things might change in the future, but I can tell you that at this point in time the documentation and also the actual code in restic attempts to replace the executable when it self-updates, unless you specify a different path using the --output option. Here’s the code:

	if opts.Output == "" {
		file, err := os.Executable()
		if err != nil {
			return errors.Wrap(err, "unable to find executable")

		opts.Output = file
1 Like

@rawtaz Hahaha…I have very quickly come to the conclusion that neither the folks nor the forum are ‘random’ here. I am greatly appreciative of all the help and advice so freely given here.

Thanks for pointing out the code. I have setup my cronjob and will wait for the next update.

1 Like