-
Notifications
You must be signed in to change notification settings - Fork 341
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 originalgit.luolix.top/gilbertchen/duplicacy
), now you usefork
(which is your github repositorygit.luolix.top/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