From 1184f934294339627b03a09e825f810e91abda1a Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 2 Oct 2008 16:29:40 +0000 Subject: come ho fatto svegliare il mac git-svn-id: svn://luxion/repos/thenautilus@389 fcb26f47-9200-0410-b104-b98ab5b095f3 --- SW/pmset-linux-workaround/document.en.rest.txt | 63 +++++++++++++++++++++++++ SW/pmset-linux-workaround/document.it.rest.txt | 64 ++++++++++++++++++++++++++ SW/pmset-linux-workaround/du2html.xsl | 1 + 3 files changed, 128 insertions(+) create mode 100644 SW/pmset-linux-workaround/document.en.rest.txt create mode 100644 SW/pmset-linux-workaround/document.it.rest.txt create mode 120000 SW/pmset-linux-workaround/du2html.xsl diff --git a/SW/pmset-linux-workaround/document.en.rest.txt b/SW/pmset-linux-workaround/document.en.rest.txt new file mode 100644 index 0000000..c510d0f --- /dev/null +++ b/SW/pmset-linux-workaround/document.en.rest.txt @@ -0,0 +1,63 @@ +=================================== + Waking up a Mac at a certain time +=================================== +:CreationDate: 2008-10-02 18:10:00 +:tags: software + +I have an old G3 iBook that I use to perform backups (using +rsnapshot_). The scripts that run the backup process start it as soon +as the machine wakes up, and put it back to sleep afterwards (using +pbbuttonsd_). Problem: every time I want to run a backup, I have to +manually wake the machine up (by pressing the power button, or opening +the lid). Clearly I'd like for the backup to happen ever if I forget, +or if I'm not at home. + +How it works on `Mac OS X` +========================== + +If that iBook were running `Mac OS X`, it would be easy:: + + pmset repeat wake MTWRFSU 05:00:00 + +and it would wake up automatically, every day at 5 in the morning +(those letters are ugly abbreviations for the English names of the +days of the week). + +But I have Linux running on that machine! + +Can it be done in Linux? +======================== + +It seems it can't: ``drivers/macintosh/via-pmu.c``, the Power +Management Unit's driver, implements only a couple of functions. + +How did I manage? +================= + +Using a trick. I started with the `Mac OS X` 10.4 installation disk, +opened a Terminal, and run ``pmset``. Which did not work, giving me an +error 0xe00002bc. Digging a bit on the Web we discover that such error +means more or less "I can't write a file". *Write a file*? Whoever +asked for such a thing? + +Reading more attentively the documentation_ for ``pmset``, we discover +that it writes a couple of file in +``/Library/Preferences/SystemConfiguration``. Obviously, having booted +off a CD, that directory is read-only. + +I can't find a way to create a ``tmpfs`` or similar, so I take a USB +stick and try to mount it. It does not work: there are no drivers for +`FAT`, or something. OK, I just format it `HFS`, and finally I mount +it:: + + mount -o union -t hfs /dev/disk5s1 /Library/Preferences/SystemConfiguration + +I re-run ``pmset``, nd finally the configuration is set. + +.. _rsnapshot: http://www.rsnapshot.org/ + +.. _pbbuttonsd: http://pbbuttons.berlios.de/ + +.. _documentazione: + http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/pmset.1.html + diff --git a/SW/pmset-linux-workaround/document.it.rest.txt b/SW/pmset-linux-workaround/document.it.rest.txt new file mode 100644 index 0000000..472c9b6 --- /dev/null +++ b/SW/pmset-linux-workaround/document.it.rest.txt @@ -0,0 +1,64 @@ +===================================== + Svegliare il Mac a un'ora stabilita +===================================== +:CreationDate: 2008-10-02 18:10:00 +:tags: software + +Ho un vecchio iBook G3 che uso per fare i backup (tramite +rsnapshot_). Gli script che ho si occupano del backup lo avviano +appena la macchina si sveglia, e poi la ri-addormentano (usando +pbbuttonsd_). Problema: tutte le volte che voglio lanciare un backup, +devo svegliarlo manualmente (premendo il pulsante di accensione, o +aprendo il coperchio/schermo). Ovviamente vorrei che i backup +avvenissero anche se mi scordo, o se non sono a casa. + +Come funziona col `Mac OS X` +============================ + +Se su quel iBook girasse `Mac OS X`, sarebbe facile:: + + pmset repeat wake MTWRFSU 05:00:00 + +e si sveglierebbe in automatico ogni giorno alle 5 del mattino (quelle +lettere sono abbreviazioni brutte per i giorni della settimana in +Inglese). + +Ma su quella macchina gira Linux! + +Si può fare da Linux? +===================== + +Purtroppo sembra proprio di no: ``drivers/macintosh/via-pmu.c``, il +driver della Power Management Unit, implementa solo un paio di +funzioni. + +Come sono riuscito? +=================== + +Ho truccato. Ho avviato con il disco di installazione di `Mac OS X` +10.4, ho aperto un terminale, e ho eseguito ``pmset``. Che non ha +funzionato, dandomi un errore 0xe00002bc. Scavando un po' in rete si +scopre che l'errore è grosso modo "non riesco a scrivere un +file". *Scrivere un file*? E chi gliel'ha chiesto? + +Leggendo meglio la documentazione_ di ``pmset``, si scopre che scrive +un paio di file in +``/Library/Preferences/SystemConfiguration/``. Ovviamente, avendo +avviato da CD, quella directory è in sola lettura. + +Non riesco a trovare un modo di creare un ```tmpfs`` o simili, per cui +prendo una chiavetta USB e provo a montarla. Non funziona: non ci sono +i driver per la `FAT`, o qualcosa del genere. Ok, formatto la +chiavetta `HFS`, e finalmente la monto:: + + mount -o union -t hfs /dev/disk5s1 /Library/Preferences/SystemConfiguration + +rilancio ``pmset`` e finalmente la configurazione entra. + +.. _rsnapshot: http://www.rsnapshot.org/ + +.. _pbbuttonsd: http://pbbuttons.berlios.de/ + +.. _documentazione: + http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/pmset.1.html + diff --git a/SW/pmset-linux-workaround/du2html.xsl b/SW/pmset-linux-workaround/du2html.xsl new file mode 120000 index 0000000..6737f0e --- /dev/null +++ b/SW/pmset-linux-workaround/du2html.xsl @@ -0,0 +1 @@ +../../common/du2html.xsl \ No newline at end of file -- cgit v1.2.3