-
Notifications
You must be signed in to change notification settings - Fork 339
Installation
Duplicacy is written in Go. If you have Go installed you can run the following command to build from the latest source:
GO111MODULE=off go get -u github.com/gilbertchen/duplicacy/...
The executable named duplicacy
will then be created under $GOPATH/bin
.
You can also build the executable manually after running the go get command.
cd $GOPATH/src/github.com/gilbertchen/duplicacy
go build duplicacy/duplicacy_main.go
The executable will be created under $GOPATH/src/github.com/gilbertchen/duplicacy
with the name duplicacy_main
.
To download the pre-built executable, please visit the releases page and select the binary that works for your platform.
Longer explanation of how to build from source
- help:
- download and install go and git and make them available in
PATH
- set $GOPATH to whichever directory you want to use as workspace (if you don't do this, go uses as default location
your_homefolder/go
) - in cmd run
go get github.com/gilbertchen/duplicacy/duplicacy
- 3.5 wait until the command finishes (it has to download A LOT) of sources needed for building duplicacy (all the libraries which duplicacy depends on -- for each supported storage and so on)
- after the download is finished,
cd
to the folder$GOPATH/src/github.com/gilbertchen/duplicacy
(see the similarity with the above github path? -> this is how go manages libraries and dependencies). There are all the sources for duplicacy.- 4.5 if you want to build a different branch from
master
, now it's the time! you have to pull the remote branch which has the changes you need into local master -- I recommend using a good GUI: Sourcetree but you can do it from cmd as well. (you monster). - 4.6 If you want to modify something in the sources, you should do it at this step (eg.: modify the number of retries for some storage)
- 4.5 if you want to build a different branch from
- now that you have the sources, you have to actually compile duplicacy: again in cmd
go install github.com/gilbertchen/duplicacy/duplicacy
- compiling should take no more than 10 seconds. You will find the executable file in the folder
$GOPATH/bin/duplicacy.exe
To build from source on macOS, Xcode must be installed because one of the dependency libraries, github.com/gilbertchen/keyring
requires cgo for security reasons (see #136 for details). If you don't want to install Xcode, you can switch to github.com/tmc/keyring
(the original library that github.com/gilbertchen/keyring
was forked from) by modifying this line in src/duplicacy_keyring.go
:
"github.com/gilbertchen/keyring"
to
"github.com/twc/keyring"
If you fork the repository github.com/gilbertchen/duplicacy
and clone the fork locally as github.com/yourusername/duplicacy
,
please remember that duplicacy/duplicacy_main.go
still imports from github.com/gilbertchen/duplicacy/src
,
so any changes you make under github.com/yourusername/duplicacy/src
will have no effect when building the executable.
Therefore, the recommended way is to clone your fork into the original namespace:
git clone https://github.com/yourusername/duplicacy $GOPATH/src/github.com/gilbertchen/duplicacy
There is one other option when working with a fork which is explained fully here. The short version is:
- Make a normal github fork of duplicacy (so that you have
github.com/you/duplicacy
); - Clone original duplicacy:
go get github.com/gilbertchen/duplicacy
, and not your fork;- The repository is locally @
cd $GOPATH/src/github.com/gilbertchen/duplicacy
;
- The repository is locally @
- Add a remote to your fork in the cloned repository
git remote add fork https://github.com/you/duplicacy
noted above; - Instead of committing/pushing to
origin
(which is the originalgithub.com/gilbertchen/duplicacy
), now you usefork
(which is your github repositorygithub.com/you/duplicacy
).
In this way, it is also very easy to test other people's code: just add a new remote to $GOPATH/src/github.com/gilbertchen/duplicacy
(the original duplicacy clone) like you did in step 3. But just change the name fork
to something else.
Note about the second method: there is no clone of github.com/you/duplicacy
therefore there shouldn't exist on your disk any folder
$GOPATH/src/github.com/you/duplicacy
.
An example for some NAS boxes - ARM, Debian with 64k pages:
cd $GOPATH/src/github.com/gilbertchen/duplicacy
env GOARCH=arm GOOS=linux go build -o duplicacy_linux64k_arm --ldflags "-R 65536" -v duplicacy/duplicacy_main.go