Skip to content

Commit ae017bf

Browse files
author
Aaron Roller
committed
granting global access to allow adoption
creating /media/amros AM-172/amros-user-check
1 parent a98e13e commit ae017bf

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

debian/postinst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def make_log_dir_available_to_all(log_dir,user):
1616
"""changes access of directory allowing anyone to read and prints a warning"""
1717
try:
1818
subprocess.check_output(["chmod","777",log_dir])
19-
print(f"WARNING: making log dir {log_dir} avilable to all users since {user} does not exist.")
19+
print(f"WARNING: making log dir {log_dir} avilable to all users. The directory will be limited to {user} group in future releases.")
2020
except subprocess.CalledProcessError as e:
2121
print(f"ERROR: unable to modify access to log dir {log_dir}: {e}")
2222

@@ -29,19 +29,19 @@ def grant_log_dir_ownership_to_user(log_dir,user):
2929

3030
def modify_access_to_log_dir(log_dir,user):
3131
"""grants access to the amros user or everyone if the user is not available"""
32-
try:
33-
subprocess.check_output(["id", "-u",user])
34-
grant_log_dir_ownership_to_user(log_dir,user)
35-
except subprocess.CalledProcessError:
36-
make_log_dir_available_to_all(log_dir,user)
32+
# try:
33+
# subprocess.check_output(["id", "-u",user])
34+
# grant_log_dir_ownership_to_user(log_dir,user)
35+
# except subprocess.CalledProcessError:
36+
#FIXME: enable the code above to grant access to AMROS group only
37+
make_log_dir_available_to_all(log_dir,user)
3738

3839
def get_platform_constant(constant_name):
3940
"""Retrieves constants from scripts available in platform scripts. Must be installed"""
4041
return subprocess.check_output(["/opt/ros/melodic/lib/am_platform_scripts/scripts/amros/amros-constants.sh", constant_name]).decode("utf-8").strip()
4142

42-
def make_dir_if_needed():
43+
def make_dir_if_needed(log_dir):
4344
"""creates the directory and grants access"""
44-
log_dir=get_platform_constant( "amros_log_dir")
4545
try:
4646
os.mkdir(log_dir)
4747
print(f"INFO: Created log directory {log_dir}")
@@ -52,4 +52,9 @@ def make_dir_if_needed():
5252
except OSError as e:
5353
print(f"ERROR: Unable to create log directory {log_dir}: {e}")
5454

55-
make_dir_if_needed()
55+
def make_dirs_if_needed():
56+
"""creates all directories needed to suppport am-utils requirements"""
57+
make_dir_if_needed(get_platform_constant( "amros_log_dir"))
58+
make_dir_if_needed(get_platform_constant( "amros_log_media_dir"))
59+
60+
make_dirs_if_needed()

0 commit comments

Comments
 (0)