{"action":"opened","issue":{"url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/149","repository_url":"https://api.github.com/repos/resin-io/resin-wifi-connect","labels_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/149/comments","events_url":"https://api.github.com/repos/resin-io/resin-wifi-connect/issues/149/events","html_url":"https://github.com/resin-io/resin-wifi-connect/issues/149","id":278011069,"number":149,"title":"Building from source files or other options for modifying resin-wifi-connect","user":{"login":"kadhirvelm","id":12898578,"avatar_url":"https://avatars2.githubusercontent.com/u/12898578?v=4","gravatar_id":"","url":"https://api.github.com/users/kadhirvelm","html_url":"https://github.com/kadhirvelm","followers_url":"https://api.github.com/users/kadhirvelm/followers","following_url":"https://api.github.com/users/kadhirvelm/following{/other_user}","gists_url":"https://api.github.com/users/kadhirvelm/gists{/gist_id}","starred_url":"https://api.github.com/users/kadhirvelm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kadhirvelm/subscriptions","organizations_url":"https://api.github.com/users/kadhirvelm/orgs","repos_url":"https://api.github.com/users/kadhirvelm/repos","events_url":"https://api.github.com/users/kadhirvelm/events{/privacy}","received_events_url":"https://api.github.com/users/kadhirvelm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-30T06:23:31Z","updated_at":"2017-11-30T06:23:31Z","closed_at":null,"author_association":"NONE","body":"**Background** \r\nWe use RPi3s to control our hardware devices, which is remotely updated through Resin. We've got the whole pipeline setup and working smoothly except we were previously using [https://github.com/resin-io-playground/resin-wifi-connect-python-example](Resin Wifi Connect Python) to let our customers get their RPi3s connected to the internet. We had to make some modifications to that code to get it to work with our software, namely writing an email address to the disk on the initial connection to be retrieved later.\r\n\r\nWe're currently in the process of updating to the latest Rust-based stuff. We would like to make the same modification to write the email address and have our RPi3s run it on start. Related to https://github.com/resin-io/resin-wifi-connect/issues/139, but we've been running into issues.\r\n\r\n**What we've done so far**\r\n\r\nWe first ported over all the files to our project, then modified server.rs to write the same email address (from our original project) to the same file:\r\n\r\n`fn connect(req: &mut Request) -> IronResult<Response> {\r\n    let (ssid, passphrase, email) = {\r\n        let params = get_request_ref!(req, Params, \"Getting request params failed\");\r\n        let ssid = get_param!(params, \"ssid\", String);\r\n        let passphrase = get_param!(params, \"passphrase\", String);\r\n        let email = get_param!(params, \"email\", String);\r\n        (ssid, passphrase, email)\r\n    };\r\n\r\n    fn write_email(email: String) {\r\n        use std::io::Write;\r\n        let mut email_file = File::create(\"/usr/share/config/userdata\").expect(\"Unable to write file\");\r\n        email_file.write_all(email.as_bytes()).expect(\"Unable to write email to created file\");\r\n    }\r\n\r\n    write_email(email);....`\r\n\r\nAnd then we wanted to get that to at least run on the RPi3s, as a sanity check, so we setup a .travis.yml to build and deploy it to resin. Not totally sure what the best way to go about that is, but this is what we've done so far:\r\n\r\n`install: true\r\nsudo: required\r\ndist: trusty\r\nservices: docker\r\nlanguage: rust\r\nrust: \"stable\"\r\naddons:\r\n  ssh_known_hosts:\r\n    - git.resin.io\r\nos: linux\r\ninstall:\r\n  - sudo apt-get install libdbus-1-dev\r\nscript:\r\n  - set -e\r\n  - cargo install cross\r\n  - cross build --release --target armv7-unknown-linux-gnueabihf\r\n  - mv target/target=armv7-unknown-linux-gnueabihf/release/wifi-connect .\r\n  - if [ $TRAVIS_BRANCH = 'development' ]; then\r\n      eval \"$(ssh-agent -s)\";\r\n      echo -e $RESIN_DEPLOY_KEY > id_rsa;\r\n      chmod 0600 id_rsa;\r\n      ssh-add ./id_rsa;\r\n      git remote add resin_dev $RESIN_REMOTE_DEV;\r\n      git add --all;\r\n      git commit -a -m \"Cargo built\";\r\n      git push -f resin_dev development:master;\r\n    fi\r\n  - set +e\r\n`\r\n\r\nNo other modifications to the source files from resin-wifi-connect. When we ran it on travis, it kept popping up this error when cross build ran:\r\n\r\n`error: failed to run custom build command for `dbus v0.5.3`\r\nprocess didn't exit successfully: `/target/release/build/dbus-c9094369a11371da/build-script-build` (exit code: 101)\r\n--- stderr\r\nthread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(PkgConfig(CrossCompilation), State { next_error: None })', /checkout/src/libcore/result.rs:906:4\r\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.`\r\n\r\nWhich we tried to fix by adding `dbus= \"0.6.0\"` to the Cargo.toml file, which changed the error to this:\r\n\r\n`error: failed to run custom build command for `libdbus-sys v0.1.1`\r\nprocess didn't exit successfully: `/target/release/build/libdbus-sys-74933906340f63f2/build-script-build` (exit code: 101)\r\n--- stderr\r\nthread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(PkgConfig(CrossCompilation), State { next_error: None })', /checkout/src/libcore/result.rs:906:4\r\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.` \r\n\r\nNow we're a bit stuck and starting to think we're probably approaching this the wrong way. Any idea what we're doing wrong? Is this the right way to modify resin-wifi-connect with the modifications we need? Would it be easier to actually build the rust application on the RPi3 itself in the Docker.template file? Happy to provide anything else needed!"}}
{"actor":{"display_login":"kadhirvelm"}}