update mount path

This commit is contained in:
link 2022-01-24 17:08:28 +08:00
parent 3f472f1864
commit 0fc65bcb3a
8 changed files with 192 additions and 258 deletions

View file

@ -33,7 +33,7 @@ func InitRouter() *gin.Engine {
r.GET("/v1/guide/check", v1.GetGuideCheck) r.GET("/v1/guide/check", v1.GetGuideCheck)
r.GET("/debug", v1.GetSystemConfigDebug) r.GET("/v1/debug", v1.GetSystemConfigDebug)
//set user //set user
r.POST("/v1/user/setusernamepwd", v1.Set_Name_Pwd) r.POST("/v1/user/setusernamepwd", v1.Set_Name_Pwd)
//get user info //get user info

View file

@ -262,7 +262,7 @@ func AddPartition(c *gin.Context) {
c.JSON(http.StatusOK, model.Result{Success: oasis_err.DISK_BUSYING, Message: oasis_err.GetMsg(oasis_err.DISK_BUSYING)}) c.JSON(http.StatusOK, model.Result{Success: oasis_err.DISK_BUSYING, Message: oasis_err.GetMsg(oasis_err.DISK_BUSYING)})
return return
} }
if !file.CheckNotExist("/mnt/" + name) { if !file.CheckNotExist("/DATA/" + name) {
// /mnt/name exist // /mnt/name exist
c.JSON(http.StatusOK, model.Result{Success: oasis_err.NAME_NOT_AVAILABLE, Message: oasis_err.GetMsg(oasis_err.NAME_NOT_AVAILABLE)}) c.JSON(http.StatusOK, model.Result{Success: oasis_err.NAME_NOT_AVAILABLE, Message: oasis_err.GetMsg(oasis_err.NAME_NOT_AVAILABLE)})
return return
@ -279,7 +279,7 @@ func AddPartition(c *gin.Context) {
service.MyService.Disk().AddPartition(path) service.MyService.Disk().AddPartition(path)
} }
mountPath := "/mnt/" + name mountPath := "/DATA/" + name
service.MyService.Disk().MountDisk(path, mountPath) service.MyService.Disk().MountDisk(path, mountPath)
@ -314,7 +314,7 @@ func PostMountDisk(c *gin.Context) {
path := c.PostForm("path") path := c.PostForm("path")
serial := c.PostForm("serial") serial := c.PostForm("serial")
mountPath := "/mnt/volume" mountPath := "/DATA/volume"
var list = service.MyService.Disk().GetSerialAll() var list = service.MyService.Disk().GetSerialAll()
var pathMapList = make(map[string]string, len(list)) var pathMapList = make(map[string]string, len(list))
for _, v := range list { for _, v := range list {

View file

@ -13,6 +13,8 @@ version_0_2_3() {
readonly CASA_DEPANDS="curl smartmontools" readonly CASA_DEPANDS="curl smartmontools"
version_0_2_5{ version_0_2_5{
install_depends "$CASA_DEPANDS" install_depends "$CASA_DEPANDS"
} }

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# copy to /casaOS/util/shell path # copy to /casaOS/util/shell path
# chmod 755 # chmod 755
@ -30,23 +30,32 @@ do_mount() {
# Figure out a mount point to use # Figure out a mount point to use
# LABEL=${ID_FS_LABEL} # LABEL=${ID_FS_LABEL}
LABEL=${DEVBASE} # LABEL=${DEVBASE}
if grep -q " /mnt/casa_${LABEL} " /etc/mtab; then # if grep -q " /DATA/USB_${LABEL} " /etc/mtab; then
# Already in use, make a unique one # # Already in use, make a unique one
LABEL+="-${DEVBASE}" # LABEL+="-${DEVBASE}"
fi # fi
DEV_LABEL="${LABEL}" # DEV_LABEL="${LABEL}"
# Use the device name in case the drive doesn't have label # # Use the device name in case the drive doesn't have label
if [ -z ${DEV_LABEL} ]; then # if [ -z ${DEV_LABEL} ]; then
DEV_LABEL="${DEVBASE}" # DEV_LABEL="${DEVBASE}"
fi # fi
MOUNT_POINT="/mnt/casa_${DEV_LABEL}" MOUNT_POINT="/DATA/USB_Storage1"
arr=("/DATA/USB_Storage1" "/DATA/USB_Storage2" "/DATA/USB_Storage3" "/DATA/USB_Storage4" "/DATA/USB_Storage5" "/DATA/USB_Storage6" "/DATA/USB_Storage7" "/DATA/USB_Storage8" "/DATA/USB_Storage9" "/DATA/USB_Storage10" "/DATA/USB_Storage11" "/DATA/USB_Storage12")
for folder in ${arr[@]}; do
#如果文件夹不存在,创建文件夹
if [ ! -d "$folder" ]; then
mkdir -p ${MOUNT_POINT}
MOUNT_POINT=$folder
break
fi
done
${log} "Mount point: ${MOUNT_POINT}" ${log} "Mount point: ${MOUNT_POINT}"
mkdir -p ${MOUNT_POINT}
# # Global mount options # # Global mount options
# OPTS="rw,relatime" # OPTS="rw,relatime"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long