Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146286866
D26640.id77879.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26640.id77879.diff
View Options
Index: Keywords/shell.ucl
===================================================================
--- Keywords/shell.ucl
+++ Keywords/shell.ucl
@@ -8,21 +8,40 @@
#
actions: [file]
-post-install: <<EOD
- case "%@" in
- /*) file="%@" ;;
- *) file="%D/%@" ;;
- esac
- cp ${PKG_ROOTDIR}/etc/shells ${PKG_ROOTDIR}/etc/shells.bak
- (grep -v "^${file}$" ${PKG_ROOTDIR}/etc/shells.bak; echo ${file}) > ${PKG_ROOTDIR}/etc/shells
- rm -f ${PKG_ROOTDIR}/etc/shells.bak
+post-install-lua: <<EOD
+ shell_path = pkg.prefixed_path("%@")
+ shell = io.open("/etc/shells", "r+")
+ while true do
+ line = shell:read()
+ if line == nil then break end
+ if line == shell_path then
+ -- the shell path is already in the shell file
+ shell:close()
+ return
+ end
+ end
+ shell:write(shell_path .. "\n")
+ shell:close()
EOD
-pre-deinstall: <<EOD
- case "%@" in
- /*) file="%@" ;;
- *) file="%D/%@" ;;
- esac
- cp ${PKG_ROOTDIR}/etc/shells ${PKG_ROOTDIR}/etc/shells.bak
- grep -v "^${file}$" ${PKG_ROOTDIR}/etc/shells.bak > ${PKG_ROOTDIR}/etc/shells
- rm -f ${PKG_ROOTDIR}/etc/shells.bak
+pre-deinstall-lua: <<EOD
+ shell_path = pkg.prefixed_path("%@")
+ shellsbuf = ""
+ shells_path = "/etc/shells"
+ shell = io.open(shells_path, "r+")
+ found = false
+ while true do
+ line = shell:read()
+ if line == nil then break end
+ if line ~= shell_path then
+ shellsbuf = shellsbuf .. line .. "\n"
+ else
+ found = true
+ end
+ end
+ shell:close()
+ if found then
+ shell = io.open(shells_path, "w+")
+ shell:write(shellsbuf)
+ shell:close()
+ end
EOD
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 2, 10:27 AM (11 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29153616
Default Alt Text
D26640.id77879.diff (1 KB)
Attached To
Mode
D26640: Lua version of @shell
Attached
Detach File
Event Timeline
Log In to Comment