diff options
author | Chris Fordham | 2016-02-13 17:25:23 +1100 |
---|---|---|
committer | Chris Fordham | 2016-02-13 17:25:23 +1100 |
commit | 68c3a5638ea86b0e0bdd62be52a5a67a7c29a1b8 (patch) | |
tree | 36ec00d3586342432ee1f43b707484357a59d573 /rightlink.install | |
download | aur-68c3a5638ea86b0e0bdd62be52a5a67a7c29a1b8.tar.gz |
Add rightlink-bin package.
Diffstat (limited to 'rightlink.install')
-rw-r--r-- | rightlink.install | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/rightlink.install b/rightlink.install new file mode 100644 index 000000000000..c80efb73295b --- /dev/null +++ b/rightlink.install @@ -0,0 +1,68 @@ +enable_start_service() { + systemctl enable rightlink + systemctl start rightlink --no-block +} + +add_rightlink_user() { + if ! id -u rightlink >/dev/null 2>&1; then + useradd -c "rightlink service" -m -d /home/rightlink -U -s /bin/false rightlink + fi +} + +post_any() { + touch /var/lib/rightscale-identity + chmod 0600 /var/lib/rightscale-identity + + add_rightlink_user + + useradd -c "RightScale Managed Login" -d /home/rightscale -s /bin/bash -m rightscale &>/dev/null + + mkdir -p /home/rightscale/.ssh + touch /home/rightscale/.ssh/authorized_keys + chmod -R go-rwx /home/rightscale/.ssh + chown -R rightscale /home/rightscale/.ssh + + # Change the cloud-init config to run user-data script at every boot so we pull in updated + # user-data after a stop&start. This is a bit of a hack, but it's not clear what else to do that + # is clean. Somehow using once-per-instance doesn't actually work, at least not on CentOS7 or + # Fedora 20. Sigh + if [[ -w /etc/cloud/cloud.cfg ]]; then + sed -i -e '/ - scripts-user$/s/scripts-user/[scripts-user, always]/' /etc/cloud/cloud.cfg + #sed -i -e '/ - scripts-user$/s/scripts-user/[scripts-user, once-per-instance]/' /etc/cloud/cloud.cfg + else + echo "Cannot fix /etc/cloud/cloud.cfg to run user-data script at every boot: stop/start may not work" + fi + + # enable_start_service + + echo + echo 'If you are not bootstrapping a cloud instance automatically:' + echo ' - Ensure you have populated /var/lib/rightscale-identity' + echo ' before starting the system service!' + echo ' (see the User Data field on the Info tab of your server)' + echo + echo "==> To enable the RightScale RightLink service:" + echo "# systemctl enable rightlink.service" + echo + echo "==> To start RightScale RightLink:" + echo "# systemctl start rightlink.service" +} + +post_install() { + post_any +} + +post_upgrade() { + systemctl daemon-reload + post_any + echo + echo "==> To restart RightScale RightLink with the new version (when upgrading):" + echo "# systemctl restart rightlink.service" +} + +post_remove() { + systemctl disable rightlink > /dev/null 2>&1 || true + systemctl stop rightlink > /dev/null 2>&1 || true +} + +# vim:set ts=2 sw=2 et: |