mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-02 02:51:53 +08:00
MSD 支持运行目录存放镜像
This commit is contained in:
@@ -52,8 +52,12 @@ def _mkdir(path: str) -> None:
|
||||
os.mkdir(path)
|
||||
|
||||
|
||||
def _chown(path: str, user: str) -> None:
|
||||
get_logger().info("CHOWN --- %s - %s", user, path)
|
||||
def _chown(path: str, user: str, optional: bool=False) -> None:
|
||||
logger = get_logger()
|
||||
if optional and not os.access(path, os.F_OK):
|
||||
logger.info("CHOWN --- %s - [SKIPPED] %s", user, path)
|
||||
return
|
||||
logger.info("CHOWN --- %s - %s", user, path)
|
||||
shutil.chown(path, user)
|
||||
|
||||
|
||||
@@ -187,7 +191,7 @@ class _GadgetConfig:
|
||||
_chown(join(func_path, "lun.0/cdrom"), user)
|
||||
_chown(join(func_path, "lun.0/ro"), user)
|
||||
_chown(join(func_path, "lun.0/file"), user)
|
||||
_chown(join(func_path, "lun.0/forced_eject"), user)
|
||||
_chown(join(func_path, "lun.0/forced_eject"), user, optional=True)
|
||||
if start:
|
||||
_symlink(func_path, join(self.__profile_path, func))
|
||||
name = ("Mass Storage Drive" if self.__msd_instance == 0 else f"Extra Drive #{self.__msd_instance}")
|
||||
|
||||
Reference in New Issue
Block a user