Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 26537 Details for
Bug 43225
custom devices with udev
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
updated script to fix perm problem.
udh.py (text/plain), 1.96 KB, created by
Ahmed Farid
on 2004-02-28 14:24:09 UTC
(
hide
)
Description:
updated script to fix perm problem.
Filename:
MIME Type:
Creator:
Ahmed Farid
Created:
2004-02-28 14:24:09 UTC
Size:
1.96 KB
patch
obsolete
>#!/usr/bin/python -O ># Distributed under the terms of the GNU General Public License v2 >#UDev Device Helper >#Changes : ># fixed permissions problem and misc tweaks >import sys,os,grp,pwd,commands,stat >default_perm = '660' >loaded_modules = commands.getoutput("lsmod | awk '{print $1'}").splitlines()[1:] >loaded_modules.append('none'); >def parse_config(conf_file='udh.conf'): > if not os.access(conf_file,os.F_OK) and len(sys.argv) > 1 and os.access(sys.argv[1], os.F_OK) : > conf_file = sys.argv[1] > f = file(conf_file,"r"); lines = f.readlines(); f.close() > final_conf = [] > for line in lines: > if not line.startswith('#'): > conf = line.strip().split(',') > temp_dict = {} > for c in conf: > cc = c.strip().split('=') > temp_dict[cc[0].strip()] = cc[1].strip() > final_conf.append(temp_dict) > return final_conf >conf = parse_config() >for line in conf: > try: > if 'kernel_module' in line and line['kernel_module'] in loaded_modules and not os.access(line['dev'],os.F_OK): > print "Making node : " + line['dev'] > if 'perm' in line : line['perm'] = default_perm > if 'dir' in line : print "\t Making Directory : " + line['dir'] + ' ' + os.mkdir(line['dir']) > n = line['node'].split(' ') > os.mknod(line['dev'], stat.S_IFCHR, os.makedev( int(n[0]), int(n[1]) ) ) > #fix this... > commands.getoutput("chmod %(p)s %(f)s" % {'p':line['perm'], 'f': line['dev']} ) > #commands.getoutput( 'mknod -m '+line['perm']+' '+line['dev']+' c '+line['node']) > gid , uid = 0 , 0 > if 'group' in line : gid = grp.getgrnam(line['group'])[2] > if 'user' in line : uid = pwd.getpwnam(line['user'])[2] > os.chown(line['dev'], uid, gid) > if 'symlink' in line : > print "\tCreating Symlink from %(src)s to %(dst)s" % {'src':line['dev'], 'dst':line['symlink']} > os.symlink(line['dev'], line['symlink']) > else: > print 'Error : [%(e)s] isn\'t currently loaded or device already exists.' % {'e':line["kernel_module"]} > except: > print "Configuration : "+ str(line)+" is invalid, please check your syntax!"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 43225
:
26534
|
26535
|
26537
|
27296