improve /mnt and PS1 conformity

filesystem: don't mount tmpfs in /mnt
shell: remove trailing slash for pwd
ps1: make the default prompt easier to interpret
This commit is contained in:
payonel 2016-06-23 07:14:16 -07:00
parent 1279537f8d
commit 462b264f31
3 changed files with 6 additions and 4 deletions

View File

@ -22,7 +22,7 @@ local function onInit()
end
local function onComponentAdded(_, address, componentType)
if componentType == "filesystem" then
if componentType == "filesystem" and require("computer").tmpAddress() ~= address then
local proxy = component.proxy(address)
if proxy then
local name = address:sub(1, 3)

View File

@ -17,7 +17,7 @@ set HOME=/home
set IFS=\
set MANPATH=/usr/man:.
set PAGER=/bin/more
set PS1='$PWD# '
set PS1='$PWD # '
set PWD=/
set SHELL=/bin/sh
set LS_COLORS="{FILE=0xFFFFFF,DIR=0x66CCFF,LINK=0xFFAA00,['*.lua']=0x00FF00}"

View File

@ -127,13 +127,15 @@ function shell.resolveAlias(command, args)
end
function shell.getWorkingDirectory()
-- if no env PWD default to /
return os.getenv("PWD") or "/"
end
function shell.setWorkingDirectory(dir)
checkArg(1, dir, "string")
dir = fs.canonical(dir) .. "/"
if dir == "//" then dir = "/" end
-- ensure at least /
-- and remove trailing /
dir = fs.canonical(dir):gsub("^$", "/"):gsub("(.)/$", "%1")
if fs.isDirectory(dir) then
os.setenv("PWD", dir)
return true