4 ms·
There are two kinds of commands: Javascript commands (like ls, cat) and scripts (ps, kill, man, csv2js, table2js). Currently, Javascript commands have to be bu
by tubelite 12y ago
There are two kinds of commands: Javascript commands (like ls, cat) and scripts (ps, kill, man, csv2js, table2js).
Currently, Javascript commands have to be built-in at "compilation" time. (I need to add a load command which will evaluate a new JS command inside the pigshell closure)
Scripts can be anywhere in PATH.
There is an rc mechanism for doing exactly what you want. At boot time, we run /etc/profile, followed by /local/rc.sh - this is a file saved in the browser's localStorage. Mine is very simple:
HOME=/home
mount http://localhost:50937/ $HOME
You can create it simply by
echo "HOME=/home\nmount http://localhost:50937/ $HOME" >/local/rc.sh
or running "edit /local/rc.sh". Edit provides a simple inline CodeMirror-based editor (actually even the CLI is a CodeMirror editor instance). I use vim on the desktop to do any serious editing. If you run psty, /home is a desktop directory visible inside pigshell, so edit on desktop/run in shell is a low-friction process.
If you manage to mess up /local/rc.sh to the point where pigshell is not "booting", then you can boot it in "safe mode" by appending #norc to the URL, i.e. http://pigshell.com/#norc http://pigshell.com/#norc
- progman 12y agoI downloaded http://pigshell.com/v/0.6.2/psty.py http://pigshell.com/v/0.6.2/psty.py, started it with "python psty.py -a" and did "mount http://localhost:50937/ http://localhost:50937/ /dir" successfully. Unfortunately only "ls /dir/file" works but neither "cat /dir/file" nor "cp /dir/file ." although "file" was marked with "chmod a+r". I get the message "Cross-origin request denied (check if psty is running)". What do I wrong?
- tubelite 12y agoArgh! This is a bug. Has been fixed in master (https://github.com/pigshell/pigshell/commit/f402ef445977015afd0f6a9ea2b10e9facfa6a9e https://github.com/pigshell/pigshell/commit/f402ef445977015a...) As a workaround in 0.6.2, please use a trailing slash in the name of the mount point. ( /dir/ rather than /dir) Alternately, use http://pigshell.com/v/0.6.3-pre4/ http://pigshell.com/v/0.6.3-pre4/ which would have the fix.
- progman 12y agoUnfortunately these suggestions don't work also. Could the problem be in psty.py? Or is my Python 2.7 obsolete? There is a strange error message in psty: EXCEPT timestamp out of range for platform time_t Traceback (most recent call last): File "psty.py", line 404, in send_head self.send_header("Last-Modified", self.date_time_string(entry["mtime"])) File "/usr/lib/python2.7/BaseHTTPServer.py", line 468, in date_time_string year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) ValueError: timestamp out of range for platform time_t
- tubelite 12y agoThis is a new bug. I'm guessing it got exposed because you have a 32-bit machine, and I've been testing so far on 64-bit. Edit line 404 of psty.py as follows: - self.send_header("Last-Modified", self.date_time_string(entry["mtime"])) + self.send_header("Last-Modified", self.date_time_string(entry["mtime"] / 1000)) If it still doesn't work, maybe we can continue the conversation on the google groups forum?
- progman 12y agoI have a 64-bit machine but your fix works great :-) Thanks for this, and thanks for sharing your amazing pigshell!