/usr/bin/mkenvdir is in rainbow 0.8.7-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/usr/bin/python
import os, sys
from os.path import join, exists, isdir
from rainbow.util import make_dirs
if len(sys.argv) < 2:
print sys.argv[0] + " DIR"
sys.exit(1)
dir = sys.argv[1]
if not exists(dir):
uid = os.geteuid()
gid = os.getegid()
make_dirs(dir, os.geteuid(), os.getegid(), 0755)
def writable(path):
return os.access(path, os.W_OK)
if exists(dir) and not (isdir(dir) and writable(dir)):
print 'DIR is not a writable directory.'
exit(1)
for k,v in os.environ.iteritems():
open(join(dir, k), 'w').write(v)
|