Moved the default cfg to a file
This allows for it to be edited in a single location, be able to be copied to the share directory for easy recovery, and later be available at install when packagingstable
parent
51e487fccb
commit
e5df9dd3ae
22
Makefile
22
Makefile
|
|
@ -13,20 +13,22 @@ TARBALLNAME=$(TARBALLPREFIX).tar.gz
|
||||||
GOBUILDFLAGS=
|
GOBUILDFLAGS=
|
||||||
GITOFF=0
|
GITOFF=0
|
||||||
|
|
||||||
.PHONY: version
|
.PHONY: configure
|
||||||
version:
|
configure:
|
||||||
echo "package main\nvar version string=\"$(VERSION)\"" > $(PROJROOT)src/version.go
|
echo "package main\nvar version string=\"$(VERSION)\"" > $(PROJROOT)src/configure.go
|
||||||
|
echo 'const CFG = `' >> $(PROJROOT)src/configure.go
|
||||||
|
cat $(PROJROOT)src/rhosts_default.cfg >> $(PROJROOT)src/configure.go
|
||||||
|
echo '`' >> $(PROJROOT)src/configure.go
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: version
|
build: configure
|
||||||
if [ ! -d $(PROJROOT)/build ]; then \
|
if [ ! -d $(PROJROOT)build ]; then \
|
||||||
mkdir -p $(PROJROOT)build/share/rhosts/systemd $(PROJROOT)build/bin \
|
mkdir -p $(PROJROOT)build/share/rhosts/systemd $(PROJROOT)build/bin \
|
||||||
;fi
|
;fi
|
||||||
|
cp src/rhosts_default.cfg $(PROJROOT)build/share/rhosts
|
||||||
|
|
||||||
cd $(PROJROOT)src && go build -o $(PROJROOT)build/bin/ $(GOBUILDFLAGS) ./
|
cd $(PROJROOT)src && go build -o $(PROJROOT)build/bin/ $(GOBUILDFLAGS) ./
|
||||||
cp -r $(PROJROOT)src/systemd $(PROJROOT)/build/share/rhosts/
|
cp -r $(PROJROOT)src/systemd $(PROJROOT)/build/share/rhosts/
|
||||||
.PHONY: build-win
|
.PHONY: build-win
|
||||||
build-win: version
|
build-win: configure
|
||||||
cd $(PROJROOT)src && GOOS=windows go build -o $(PROJROOT) $(GOBUILDFLAGS) ./
|
cd $(PROJROOT)src && GOOS=windows go build -o $(PROJROOT) $(GOBUILDFLAGS) ./
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: build
|
install: build
|
||||||
|
|
@ -67,8 +69,8 @@ clean:
|
||||||
if [ -f $(PROJROOT)rhosts.exe ]; then \
|
if [ -f $(PROJROOT)rhosts.exe ]; then \
|
||||||
rm -r $(PROJROOT)rhosts.exe \
|
rm -r $(PROJROOT)rhosts.exe \
|
||||||
;fi
|
;fi
|
||||||
if [ -f $(PROJROOT)src/version.go ]; then \
|
if [ -f $(PROJROOT)src/configure.go ]; then \
|
||||||
rm -r $(PROJROOT)src/version.go \
|
rm -r $(PROJROOT)src/configure.go \
|
||||||
;fi
|
;fi
|
||||||
if [ -f $(PROJROOT)$(TARBALLNAME) ]; then \
|
if [ -f $(PROJROOT)$(TARBALLNAME) ]; then \
|
||||||
rm $(PROJROOT)$(TARBALLNAME) \
|
rm $(PROJROOT)$(TARBALLNAME) \
|
||||||
|
|
|
||||||
|
|
@ -62,22 +62,6 @@ const GPL =`
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
`
|
`
|
||||||
|
|
||||||
const CFG =`
|
|
||||||
# There are 3 types of entries: download, site, and whitelist. Downloads are
|
|
||||||
# downloaded and stripped of comments and bad entries if possible before being
|
|
||||||
# added to a list of sites. Whitelisted urls are removed from the list of sites.
|
|
||||||
# From there all the urls are added to the hosts file for both IPv4 and IPv6.
|
|
||||||
# You can also add comments by prepending with a '#'.
|
|
||||||
|
|
||||||
# This is a static entry
|
|
||||||
#site=www.site.xyz
|
|
||||||
# This is a download entry
|
|
||||||
#download=w3.site.xyz/location/to/config.txt
|
|
||||||
# This is a whitelist entry
|
|
||||||
#whitelist=www.site.xyz
|
|
||||||
|
|
||||||
# A suggested download is: https://github.com/StevenBlack/hosts
|
|
||||||
#download=https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts`
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
tmpdir := ""
|
tmpdir := ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue