Date: Sat, 17 Jul 2010 15:34:08 +0200 From: joris dedieu <joris.dedieu@gmail.com> To: freebsd-hackers@freebsd.org Subject: [PATCH] allow empty files creation with install Message-ID: <AANLkTimMKTOUnUUAZKntuYneBcB9qPCORqDZMybMNWca@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
--0015174bdea4e13a5f048b95636a Content-Type: text/plain; charset=ISO-8859-1 This patch add a -t switch to install(3). This is a small feature for lazy sysadmins. before : touch /usr/home/foo/.history /usr/home/foo/.bash_history chown foo /usr/home/foo/.history /usr/home/foo/.bash_history chmod 600 /usr/home/foo/.history /usr/home/foo/.bash_history chflags sappend /usr/home/foo/.history /usr/home/foo/.bash_history after : install -o foo -g foo -m 600 -f sappend /usr/home/foo/.history /usr/home/foo/.bash_history Regards, Joris --0015174bdea4e13a5f048b95636a Content-Type: application/octet-stream; name="xinstall.patch" Content-Disposition: attachment; filename="xinstall.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbqhwci90 ZGlmZiAtTnVyIHVzci5iaW4veGluc3RhbGwub3JpZy9pbnN0YWxsLjEgdXNyLmJpbi94aW5zdGFs bC9pbnN0YWxsLjEKLS0tIHVzci5iaW4veGluc3RhbGwub3JpZy9pbnN0YWxsLjEJMjAxMC0wNy0w NSAwODozNTowMS4wMDAwMDAwMDAgKzAyMDAKKysrIHVzci5iaW4veGluc3RhbGwvaW5zdGFsbC4x CTIwMTAtMDctMTcgMTQ6NTk6NDAuMTI3MDI0NTE5ICswMjAwCkBAIC02Miw2ICs2MiwxNSBAQAog Lk9wIEZsIG0gQXIgbW9kZQogLk9wIEZsIG8gQXIgb3duZXIKIC5BciBkaXJlY3RvcnkgLi4uCisu Tm0KKy5GbCB0CisuT3AgRmwgdgorLk9wIEZsIGcgQXIgZ3JvdXAKKy5PcCBGbCBmIEFyIGZsYWdz CisuT3AgRmwgbSBBciBtb2RlCisuT3AgRmwgbyBBciBvd25lcgorLkFyIGZpbGUgLi4uCisKIC5T aCBERVNDUklQVElPT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BbLW0g bW9kZV1cbiIKICIgICAgICAgICAgICAgICBbLW8gb3duZXJdIGZpbGUxIC4uLiBmaWxlTiBkaXJl Y3RvcnlcbiIKLSIgICAgICAgaW5zdGFsbCAtZCBbLXZdIFstZyBncm91cF0gWy1tIG1vZGVdIFst byBvd25lcl0gZGlyZWN0b3J5IC4uLlxuIik7CisiICAgICAgIGluc3RhbGwgLWQgWy12XSBbLWcg Z3JvdXBdIFstbSBtb2RlXSBbLW8gb3duZXJdIGRpcmVjdG9yeSAuLi5cbiIKKyIgICAgICAgaW5z dGFsbCAtdCBbLXZdIFstZyBncm91cF0gWy1mIGZsYWdzXSBbLW0gbW9kZV0gWy1vIG93bmVyXSBm aWxlIC4uLlxuIik7CiAJZXhpdChFWF9VU0FHRSk7CiAJLyogTk9UUkVBQ0hFRCAqLwogfQo= --0015174bdea4e13a5f048b95636a--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimMKTOUnUUAZKntuYneBcB9qPCORqDZMybMNWca>