Documentation : ajoute des info() .
[lhc/ateliers.git] / vm_remote
index 9b37839..a1afa1a 100755 (executable)
--- a/vm_remote
+++ b/vm_remote
@@ -10,7 +10,8 @@ rule_help () { # SYNTAX: [--hidden]
                DESCRIPTION:
                  ce script regroupe des règles pour administrer la VM ($vm_fqdn)
                  _depuis_ une machine distante ;
-                 il sert à la fois d'outil et de documentation.
+                 il sert à la fois d'outil (aisément bidouillable)
+                 et de documentation (préçise).
                  Voir \`$tool/vm_host'   pour les règles côté machine hôte ($vm_host).
                  Voir \`$tool/vm_hosted' pour les règles côté VM hébergée ($vm_fqdn).
                SYNTAX: $0 \$RULE \${RULE}_SYNTAX
@@ -27,20 +28,24 @@ rule_git_config () { # DESCRIPTION: configure le .git local pour bien pousser
        cd "$tool"
        git remote rm host || true
        git remote add host $vm_host:tool/vm
-       git config --replace remote.host.push HEAD:refs/heads/origin
+       git config --replace remote.host.push HEAD:refs/remotes/master
        git remote rm hosted || true
        git remote add hosted root@$vm_fqdn:tool/vm
-       git config --replace remote.hosted.push HEAD:refs/heads/origin
+       git config --replace remote.hosted.push HEAD:refs/remotes/master
        )
  }
 rule_git_push () { # SYNTAX: {host|hosted} $git_push_options
        local remote=${1#remote=}; shift
        GIT_SSH=./vm_ssh git push -v "$remote" "$@"
+       info "penser à faire : vm_hosted git_reset"
  }
 
 rule_ssh () {
        "$tool"/vm_ssh $vm_fqdn "$@"
  }
+rule_mosh () {
+       mosh --ssh="$tool/vm_ssh $*" $vm_fqdn
+ }
 rule__ssh_known_hosts_update () {
        rule ssh \
         -o StrictHostKeyChecking=no \
@@ -49,7 +54,7 @@ rule__ssh_known_hosts_update () {
         whoami
  }
 rule_key_disk_send () {
-       gpg --decrypt var/lib/luks/$vm_fqdn.key.gpg |
+       gpg --decrypt var/sec/luks/$vm_fqdn.key.gpg |
        "$tool"/vm_ssh root@$vm_fqdn "$@" \
         -o CheckHostIP=no \
         -o HostKeyAlias=init.$vm_fqdn \
@@ -58,7 +63,7 @@ rule_key_disk_send () {
 rule_key_disk_backup () {
        for part in root var home
         do
-               mkdir -p var/lib/luks
+               mkdir -p var/sec/luks
                rule ssh -l root ' \
                        tmp=$(mktemp)
                        cryptsetup luksHeaderBackup \
@@ -68,7 +73,7 @@ rule_key_disk_backup () {
                        shred --remove "$tmp"
                 ' |
                gpg --encrypt --recipient $USER@ \
-                -o var/lib/luks/${vm_lvm_lv}_${part}.luks.gpg
+                -o var/sec/luks/${vm_lvm_lv}_${part}.luks.gpg
         done
  }