1
0
Fork 0

added fstab setup script

This commit is contained in:
Kim, Jimin 2022-03-18 20:10:40 +09:00
parent 2730e8344e
commit 2f62c1488f

22
src/setup/system/fstab.py Normal file
View file

@ -0,0 +1,22 @@
from os import system
name = "fstab"
def setup():
"""adds /media/pomp/data drive to fstab"""
fstab_path = "/etc/fstab"
# check if /media/pomp/data exists already
with open(fstab_path, "rt") as f:
if "/media/pomp/data" in f.read():
return
line_to_write = (
"UUID=1cea13a5-ea19-4023-99dd-4bfd062a288c /media/pomp/data ext4 defaults 0 2"
)
# append a line to the end and ignore output
# not using python's file interface because I don't wanna deal with permission stuff
system(f'echo "{line_to_write}" | sudo tee -a {fstab_path} >/dev/null')