mirror of
https://github.com/FunKey-Project/FunKey-OS.git
synced 2025-12-12 15:48:51 +01:00
better share start script, retrofe improvements
This commit is contained in:
parent
c595c7ac3a
commit
87dead9920
@ -81,6 +81,22 @@ stop_share () {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Start sharing the backing store partition
|
||||
start_share () {
|
||||
|
||||
# 1) Check if the backing store partition is already shared
|
||||
cat $BACKING_STORE_FILE | egrep -q ^/dev/mmcblk0p3 && die 12 "the backing store partition is already shared"
|
||||
|
||||
# 2) Check if USB data is connected
|
||||
is_usb_data_connected > /dev/null 2>&1 || die 13 "USB sharing impossible, not connected to a host"
|
||||
|
||||
# 3) Unmount the backing store partition if it is locally mounted
|
||||
unmount_share
|
||||
|
||||
# 4) Everything is now clear to start sharing the backing store partition
|
||||
info "start sharing the backing store partition"
|
||||
echo /dev/mmcblk0p3 > $BACKING_STORE_FILE || die 14 "cannot share the backing store partition"
|
||||
}
|
||||
|
||||
# Return if currently sharing
|
||||
is_share_started () {
|
||||
@ -95,51 +111,6 @@ is_share_started () {
|
||||
return $res
|
||||
}
|
||||
|
||||
# Start sharing the backing store partition
|
||||
start_share () {
|
||||
|
||||
# 1) Check if the backing store partition is already shared
|
||||
cat $BACKING_STORE_FILE | egrep -q ^/dev/mmcblk0p3 && die 12 "the backing store partition is already shared"
|
||||
|
||||
# 2) Unmount the backing store partition if it is locally mounted
|
||||
unmount_share
|
||||
|
||||
# Everything is now clear to start sharing the backing store partition
|
||||
info "start sharing the backing store partition"
|
||||
echo /dev/mmcblk0p3 > $BACKING_STORE_FILE || die 13 "cannot share the backing store partition"
|
||||
|
||||
# Check if we are connected to an USB host
|
||||
local trials=0
|
||||
local not_ready=1
|
||||
while [ ${trials} -lt 5 -a ${not_ready} -eq 1 ]; do
|
||||
|
||||
# Get connection state
|
||||
local udc_state=$(cat /sys/class/udc/musb-hdrc.1.auto/state)
|
||||
sleep 1
|
||||
let trials=$trials+1
|
||||
|
||||
# Check if USB is connected
|
||||
if [ x"$udc_state" == "xconfigured" ]; then
|
||||
|
||||
# Connected succesfully to a host
|
||||
info "backing store file shared"
|
||||
return 0
|
||||
elif [ x"$udc_state" == "xdefault" ]; then
|
||||
|
||||
# Connected succesfully to a host
|
||||
info "USB sharing in progress"
|
||||
else
|
||||
# Connection failed
|
||||
not_ready=0
|
||||
fi
|
||||
done
|
||||
|
||||
# No USB host connected
|
||||
warn "no host, stop USB sharing"
|
||||
stop_share
|
||||
die 14 "not connected to a host"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
init)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
RETROFE_VERSION = f561c02646ef4400a3d9a6cef0d1f4946f3ce5c8
|
||||
RETROFE_VERSION = 10fcd1bcc7d0a9faa5278b004fd21be89513b564
|
||||
RETROFE_SITE_METHOD = git
|
||||
#RETROFE_SITE = ssh://git@github.com/FunKey-Project/FunKey-Launcher-retrofe.git
|
||||
RETROFE_SITE = ssh://git@fk/FunKey-Project/FunKey-Launcher-retrofe.git
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user