diff --git a/makefile b/makefile index f155f5c..cc8b326 100644 --- a/makefile +++ b/makefile @@ -43,12 +43,6 @@ register:; $(Q)./bin/authc user register $(NAME) $(EMAIL) validate:; $(Q)./bin/authc user validate $(NAME) $(ACTIVATION_KEY) get-user:; $(Q)./bin/authc user get $(NAME) $(LOGIN_OPT) -USER_DB ?= /tmp/migration-authd-user-db.txt -$(USER_DB): ; ./bin/migration-filter.awk < /tmp/usrdb | grep -a -v "^INVALID" | sort | uniq > $(USER_DB) -migration-file: $(USER_DB) -migrate-user:; ./bin/authc user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT) -migrate-all-users:; ./bin/authc migration-script $(USER_DB) $(LOGIN_OPT) - SERVICE ?= 'auth' RESOURCE ?= '*' UID ?= 1000 @@ -89,3 +83,5 @@ wipe-db: release: make build-server OPTS="--progress --release" + +-include migration.mk diff --git a/migration.mk b/migration.mk new file mode 100644 index 0000000..40463cd --- /dev/null +++ b/migration.mk @@ -0,0 +1,30 @@ +# This is the migration makefile. +# +# WHAT IS NEEDED FOR THE MIGRATION: +# +# - $(SQLDB): a dump of the SQL database (format: login password domain) +# +# HOW MIGRATION WORKS, STEP BY STEP (`migration` rule): +# +# 1. migration-file -> create the $(USER_DB) file +# 2. migrate-all-users -> migrate all user accounts +# +# AFTER THE `migration` RULE: go to the dnsmanagerd repository and follow instructions. + +# DB from SQL, format: login password domain +SQLDB ?= /tmp/usrdb + +USER_DB ?= /tmp/migration-authd-user-db.txt + +$(USER_DB): + ./bin/migration-filter.awk < $(SQLDB) | grep -a -v "^INVALID" | sort | uniq > $(USER_DB) + +migration-file: $(USER_DB) + +migrate-user: + ./bin/authc user migrate $(NAME) $(PASSWORD_HASH) $(LOGIN_OPT) + +migrate-all-users: + ./bin/authc migration-script $(USER_DB) $(LOGIN_OPT) + +migration: migration-file migrate-all-users