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 packaging
stable
Justin Reichardt 2022-06-13 00:56:43 -05:00
parent 51e487fccb
commit e5df9dd3ae
2 changed files with 12 additions and 26 deletions

View File

@ -13,20 +13,22 @@ TARBALLNAME=$(TARBALLPREFIX).tar.gz
GOBUILDFLAGS=
GITOFF=0
.PHONY: version
version:
echo "package main\nvar version string=\"$(VERSION)\"" > $(PROJROOT)src/version.go
.PHONY: configure
configure:
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
build: version
if [ ! -d $(PROJROOT)/build ]; then \
build: configure
if [ ! -d $(PROJROOT)build ]; then \
mkdir -p $(PROJROOT)build/share/rhosts/systemd $(PROJROOT)build/bin \
;fi
cp src/rhosts_default.cfg $(PROJROOT)build/share/rhosts
cd $(PROJROOT)src && go build -o $(PROJROOT)build/bin/ $(GOBUILDFLAGS) ./
cp -r $(PROJROOT)src/systemd $(PROJROOT)/build/share/rhosts/
.PHONY: build-win
build-win: version
build-win: configure
cd $(PROJROOT)src && GOOS=windows go build -o $(PROJROOT) $(GOBUILDFLAGS) ./
.PHONY: install
install: build
@ -67,8 +69,8 @@ clean:
if [ -f $(PROJROOT)rhosts.exe ]; then \
rm -r $(PROJROOT)rhosts.exe \
;fi
if [ -f $(PROJROOT)src/version.go ]; then \
rm -r $(PROJROOT)src/version.go \
if [ -f $(PROJROOT)src/configure.go ]; then \
rm -r $(PROJROOT)src/configure.go \
;fi
if [ -f $(PROJROOT)$(TARBALLNAME) ]; then \
rm $(PROJROOT)$(TARBALLNAME) \

View File

@ -62,22 +62,6 @@ const GPL =`
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() {
tmpdir := ""