diff --git a/.travis.yml b/.travis.yml index 43217fd..5c1ff2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,25 @@ language: rust env: global: - - PROJECT_NAME=lindyndns - - RUST_BACKTRACE=full - - secure: dxDKfaOmGZM9kH7wv/W/zrLZfhMy1O8gDpti0ybbO323TI9kDW45egNzTQTwbUiYD87TawT99IC3gw9R6kok29YyHLQzhu1PNrMMEy8o+8dxoSzJnTfZY2oPy+7uqOGOKiApVJen8OI+a29/WYL9liJj5A4yXjoKMs+wa+KLxSjDaCPv3ZrEPresrk1JiTLPWWyNNCF7hR+ax/hG3EXvO+VHkkOBjodJZCgihSYmr0Y2s70cWODFCbKK5y+dnzEXMhZjR+bGUSJUmXDxkBhE1lxn7ia0d0tgEf4LM5PG2HWouA7dFgKTh35nAvQBoR2fyWDT7+pLfj/k2tmtyeJtDucbVHWVW1e/EovHfg1QsKM3rY/grWOvjkv3duZpM4Ej6Zlwd+l9iS5LaHan7h3sV+8bQLfKSZBvHcZPn89Rqih6xIsqbj4FkiC2R3CHle2dLqjd2A0VC6v7wLQ04ko4DsOlsUACMOOm2hYfMvXCqQ0FUwyUTFxYA7+gY4ebjnIh5IKYu14pPYQ4QqM/LcbM2fuRfIFWIwI5WXSWfIXJEN7smr0q/has2/YqgS+wiH7zf8VF3SKbHCKkcV1EqTsD7e0nu1KgKqdXTjYjPg4FOoRmHp/pTH+xPrCnTIjW9EHuIYmxil/PiaYcRJrLW+hOiTuxB1iNxmx+7VDcSG+xmj8= - - secure: UAcmn3LRK4KztAld8zChi/EobhLtiyMmvYKFQGCZ6kRTbodZNc1YG8qhho7RuF7aQaxtGX80qWzPEx8DvPE5PjFjJFUSprNe5JwXW97tMTs/3AfgkLDPMpj2EuXO6WjzsrBfv51IiXF4AYQVOULlFEoFc+NOaJAdiSge9oiaQGjo+H6pRr63KJdp25E7iN1ml5WBOBa8QckXXaAFzCrZSzBlR7g7mlk7ZoOkuSmD+/AGPQaNaX8p25ffGOOtaweADIUU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ust: nightly + env: TARGET=x86_64-unknown-linux-gnu + - os: osx + rust: nightly + env: TARGET=x86_64-apple-darwin + sudo: required - os: windows rust: nightly filter_secrets: false - env: + env: - TARGET_ARCH=x86_64 - TARGET=x86_64-pc-windows-msvc - PATH="/c/Program Files (x86)/NSIS/Bin:$PATH" @@ -19,25 +27,16 @@ matrix: - os: windows rust: nightly filter_secrets: false - env: + env: - TARGET_ARCH=i686 - TARGET=i686-pc-windows-msvc - PATH="/c/Program Files (x86)/NSIS/Bin:$PATH" sudo: required - - os: linux - dist: xenial - rust: nightly - env: TARGET=x86_64-unknown-linux-gnu - - os: osx - rust: nightly - env: TARGET=x86_64-apple-darwin - sudo: required script: - - "ci/build.sh" - - "ci/test.sh" + - ci/build.sh + - ci/test.sh before_deploy: - - "ci/package.sh" - - export TRAVIS_TAG="preview" + - ci/package.sh cache: directories: - "${HOME}/.cargo" @@ -51,7 +50,7 @@ deploy: overwrite: true draft: true on: - all_branches: true - # branch: master + branch: master + tags: true api_key: - secure: uaRr+l0vYNqTetNQ/1b5qROlXLYn9yeK1KZa6SEUqC3uId/4TVxhHfGrg/7QanX0YeMxBogaWj1r2+HzO5LAsAdViMTMcGSnsXVtpz7GQzPnOc5mX9LTvF9I6OThWXhtQrtc9WNSM1jOb3kRUyBzTya4R1xuajkdFamBC3fJjR+a+FmLqgdIvAIvjMGMzBwNaC0CLIisK8hOrjMacyL7mCZzYPIWAhzalrzqzhRoSj8usp2qkZhShfwa9cheMk0z2S+KdoQVY/IEidv93TiHlfPSuuvFX03QLRe1NBGwpP7OsAuvVQ6Lv+WEvknPU4lu9OWQvcKASUdm9Pft0RfZ+ANPEhSSKvBn0zUUXqa0+/54a1ClceXw694MtTEqeikgcbm5eAEqb08/IA1rmaW123xsDX8iTzhlnpzPuR3+zPZU8EBq6sw0FGmJ/3yvMmLjTK3uM6hph6quCayOXQrWXUMO1humlBCKryGqNQthfzljhZDAnZCoMiORCZXvfQIV2fjvMxgrZLMOb29DVj2o1xn8S+Rz3ddUs3xO8b+HsCBPyu0uCK0DUJHsDi6A2pgBEtYiFV4LRU1WgHav1rtEKk7b+DOZwMpB79P0hzBW5+fMVnqXPhMucCMAj8pOhg89jW5g2+ufoyhbJCrFYiZR6251iSkxN45uBMwt0qLXaTk= + secure: CpPhIAZD4yquhISO8VENFpyIUvvWM6UyO5tulPyezsDXr9aeD9QXTLOcDwLU2GnwoHOMeNjB6EsBT82oh/Zdr2246aNwVmCFSdmXzSUyK/k2485f4T0H3AyTJtPFcybynTBgnUSTzMoz7cRWCi2q6T7qKQTpVfv7R5NwQYrilNyrlQCEtL8BooSuMqUqdxVbdv5h006jxKRuayn+IvmvmjohLCmt279Tsa5Fl29TDWA3kwQCMbtswNPaNeA9V6LlHkAfmMq3/HLwTcZA+aCmGPd0qmGKB/ghwqUhKm0vU+2NjGyUFq8KDc/vxl9XDJtVYotB3PjPASKyUk4cAw4dwAbIAqMovfnB0RFDDQPBCgjyceO0+SpNjwn50P67Q9RXyRIi+W0I+qekontkIO/a1o5ZAV886W35sNBMtjUwjhDVmqYI9cvH3Tn0kb0Ia2we8fIhYRVzzHe09H2Nh+6BMIk9aziGegSuD8R3XqKCnazy1jhszcNBvRKmE7m7OkXl1hMnZMg7rtjTjGlL+NJ/pkumUkdCoKqaI02zuYqPECaSDeCrNLbU8XIdkW4huhcXE8ufxNgvxmFmzh0HQA09xSLOLNDTRRaiWW3rncv4zxI1KSUDudcOnF9rcSlcggJzKfu3uhAEVwhnwoKEb9izceFb7DKk8fzANexnkAm4aek= diff --git a/Cargo.lock b/Cargo.lock index 24474d8..448dd53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -455,7 +455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lindyndns" -version = "0.0.0" +version = "0.1.0" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index d05e794..5c9b53e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lindyndns" -version = "0.0.0" +version = "0.1.0" license = "MIT" authors = ["John Ramsden "] edition = "2018" diff --git a/README.md b/README.md index 754dbff..f828c60 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # lindyndns -[![Build Status](https://travis-ci.com/johnramsden/lindyndns.svg?token=4X1vWwTyHTHCUwBTudyN&branch=master)](https://travis-ci.com/johnramsden/lindyndns) +[![Build Status](https://travis-ci.com/johnramsden/lindyndns.svg?branch=master)](https://travis-ci.com/johnramsden/lindyndns) Linode Dynamic DNS Client @@ -49,6 +49,31 @@ Running `lindyndns` will create the specified domain if the user has permissions If all permissions are correct, running `lindyndns` will update the specified domain, and print the IP address of the user. +### Scheduling + +After creating configuration, start the service. The config should be system +wide if running the system service. + +#### Linux + +``` +systemctl enable --now lindyndns.timer +``` + +#### MacOS + +``` +launchctl bootstrap system /Library/LaunchDaemons/ca.johnramsden.lindyndns.plist +``` + +Modify the update interval by editing `/Library/LaunchDaemons/ca.johnramsden.lindyndns.plist`. + +Check it's running with `launchctl list | grep lindyndns` + +#### Windows + +If installed from the `.exe` installer, a schedule of job should have been created in the windows scheduler which will run every half hour. + ## Installing Several pre-built packages are available depending on the platform under the [releases page](https://github.com/johnramsden/lindyndns/releases). diff --git a/ci/package.sh b/ci/package.sh index 0562808..3c65d97 100755 --- a/ci/package.sh +++ b/ci/package.sh @@ -6,9 +6,9 @@ set -e tmpdir="$(mktemp -d)" -[ -n "${TRAVIS_TAG}" ] && tag="-${TRAVIS_TAG}" || tag="-0.0.0" +if [ -n "${TRAVIS_TAG}" ]; then version="${TRAVIS_TAG}"; else version="0.0.0"; fi -name="${PROJECT_NAME}${tag}-${TARGET}" +name="${PROJECT_NAME}-${version}-${TARGET}" staging="${tmpdir}/${PROJECT_NAME}" out_dir="$(pwd)/deployment" @@ -32,6 +32,7 @@ osx() { cd munkipkg cp -r "${TRAVIS_BUILD_DIR}/packaging/macos/munkipkg/lindyndns" lindyndns + echo "version: '${version}'" >> lindyndns/build-info.yaml payload="lindyndns/payload" plist='ca.johnramsden.lindyndns.plist' @@ -44,7 +45,6 @@ osx() { cp "${staging}/lindyndns" "${bindir}" cp "${TRAVIS_BUILD_DIR}/packaging/macos/${plist}" "${launch_daemons}" - ( python3 -m venv venv && . venv/bin/activate && \ pip install -r requirements.txt && \ @@ -70,7 +70,7 @@ windows() { cd "nsis" makensis.exe "installer_${TARGET_ARCH}.nsi" - cp "lindyndns_setup_${TARGET_ARCH}.exe" "${out_dir}" + cp "lindyndns_setup_${TARGET_ARCH}.exe" "${out_dir}/lindyndns-${version}_setup_${TARGET_ARCH}.exe" ) } diff --git a/ci/test.sh b/ci/test.sh index 84151ab..c79d4e5 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -3,8 +3,7 @@ set -o errexit create_config() { - config="${1}" - cat << EOF > "${config}" + cat << EOF api_token = "${API_KEY}" domain = "${TRAVIS_OS_NAME}${TRAVIS_COMMIT}.${DOMAIN}" soa_email = "${EMAIL}" @@ -14,7 +13,7 @@ EOF linux() { config_prefix="${HOME}/.config/lindyndns" mkdir -p "${config_prefix}" - create_config "${config_prefix}/config.toml" + create_config > "${config_prefix}/config.toml" } osx() { @@ -22,18 +21,18 @@ osx() { launch_daemons='/Library/LaunchDaemons' sudo cp "packaging/macos/${plist}" "${launch_daemons}" - sudo launchctl load "${launch_daemons}/${plist}" + sudo launchctl bootstrap system "${launch_daemons}/${plist}" - config_prefix="${HOME}/Library/Preferences/lindyndns" - mkdir -p "${config_prefix}" + config_prefix="/Library/Preferences/lindyndns" + sudo mkdir -p "${config_prefix}" - create_config "${config_prefix}/config.toml" + create_config | sudo tee "${config_prefix}/config.toml" > /dev/null } windows() { config_prefix="${LOCALAPPDATA}"'\lindyndns' mkdir -p "${config_prefix}" - create_config "${config_prefix}"'\config.toml' + create_config > "${config_prefix}"'\config.toml' } test() { diff --git a/packaging/macos/ca.johnramsden.lindyndns.plist b/packaging/macos/ca.johnramsden.lindyndns.plist index c0e8523..64eb9a8 100644 --- a/packaging/macos/ca.johnramsden.lindyndns.plist +++ b/packaging/macos/ca.johnramsden.lindyndns.plist @@ -9,6 +9,6 @@ /usr/local/bin/lindyndns StartInterval - 300 + 1800 diff --git a/packaging/macos/munkipkg/lindyndns/build-info.yaml b/packaging/macos/munkipkg/lindyndns/build-info.yaml index 5d4662d..c60de7a 100644 --- a/packaging/macos/munkipkg/lindyndns/build-info.yaml +++ b/packaging/macos/munkipkg/lindyndns/build-info.yaml @@ -6,4 +6,3 @@ ownership: recommended postinstall_action: none preserve_xattr: false suppress_bundle_relocation: true -version: '0.0.0' diff --git a/src/lib.rs b/src/lib.rs index 58fecaa..a68f017 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,7 @@ pub fn expected_config_location() -> (String, String) { } else if cfg!(target_os = "macos") { ( String::from("/Library/Preferences/lindyndns/config.toml"), - String::from("~/Library/Preferences//lindyndns/config.toml") + String::from("~/Library/Preferences/lindyndns/config.toml") ) } else { ( diff --git a/src/main.rs b/src/main.rs index d6df664..e484bb7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ use lindyndns::{run, find_config, expected_config_location}; fn main() -> Result<(), Box> { let matches = App::new("lindyndns") - .version("0.0.0") + .version("0.1.0") .author("John Ramsden ") .about("Linode Dynamic DNS Client") .arg(