forked from Louisvdw/dbus-serialbattery
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed driver location, changed to overlay fs, use modules shipped w…
…ith driver
- Loading branch information
Showing
14 changed files
with
571 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash | ||
|
||
# elaborate version string for better comparing | ||
# https://github.com/kwindrem/SetupHelper/blob/ebaa65fcf23e2bea6797f99c1c41174143c1153c/updateFileSets#L56-L81 | ||
function versionStringToNumber () | ||
{ | ||
local p4="" ; local p5="" ; local p5="" | ||
local major=""; local minor="" | ||
|
||
# first character should be 'v' so first awk parameter will be empty and is not prited into the read command | ||
# | ||
# version number formats: v2.40, v2.40~6, v2.40-large-7, v2.40~6-large-7 | ||
# so we must adjust how we use paramters read from the version string | ||
# and parsed by awk | ||
# if no beta make sure release is greater than any beta (i.e., a beta portion of 999) | ||
|
||
read major minor p4 p5 p6 <<< $(echo $1 | awk -v FS='[v.~-]' '{print $2, $3, $4, $5, $6}') | ||
((versionNumber = major * 1000000000 + minor * 1000000)) | ||
if [ -z $p4 ] || [ $p4 = "large" ]; then | ||
((versionNumber += 999)) | ||
else | ||
((versionNumber += p4)) | ||
fi | ||
if [ ! -z $p4 ] && [ $p4 = "large" ]; then | ||
((versionNumber += p5 * 1000)) | ||
large=$p5 | ||
elif [ ! -z $p6 ]; then | ||
((versionNumber += p6 * 1000)) | ||
fi | ||
} | ||
|
||
|
||
# create overlay-fs and mount it, if not already mounted | ||
function mountOverlayFs () | ||
{ | ||
path="/data/overlay-fs" | ||
lowerDir=$1 | ||
|
||
if [ -z $2 ]; then | ||
# replace / with _ | ||
overlayName=${1//\//_} | ||
else | ||
overlayName=$2 | ||
fi | ||
|
||
|
||
if [ ! -d "${path}/${overlayName}/upper" ]; then | ||
mkdir -p "${path}/${overlayName}/upper" | ||
fi | ||
if [ ! -d "${path}/${overlayName}/work" ]; then | ||
mkdir -p "${path}/${overlayName}/work" | ||
fi | ||
if [ ! -d "${path}/${overlayName}/merged" ]; then | ||
mkdir -p "${path}/${overlayName}/merged" | ||
fi | ||
|
||
|
||
# check if overlay is already mounted | ||
if ! mountpoint -q "${path}/${overlayName}/merged"; then | ||
# Mount the overlay | ||
mount -t overlay overlay_${overlayName} -o lowerdir=${lowerDir},upperdir=${path}/${overlayName}/upper,workdir=${path}/${overlayName}/work ${path}/${overlayName}/merged | ||
|
||
# Check if the mount was successful | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Could not mount overlay for ${lowerDir}" | ||
return 1 | ||
fi | ||
fi | ||
|
||
|
||
# check if overlay is already mounted | ||
if ! mountpoint -q "${lowerDir}"; then | ||
# Bind mount to the lower directory path | ||
mount --bind ${path}/${overlayName}/merged ${lowerDir} | ||
|
||
# Check if the bind mount was successful | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Could not bind mount overlay for ${lowerDir}" | ||
return 1 | ||
fi | ||
fi | ||
} |
Oops, something went wrong.