瀏覽代碼

Add some subdirectories to the mesh public desktop folder

Bob Mottram 7 年之前
父節點
當前提交
e88753d38b
共有 2 個文件被更改,包括 22 次插入1 次删除
  1. 3
    1
      src/freedombone-image-mesh
  2. 19
    0
      src/meshavahi

+ 3
- 1
src/freedombone-image-mesh 查看文件

@@ -680,7 +680,9 @@ function setup_ipfs {
680 680
     TOX_ID='none'
681 681
     if [ -d /home/$MY_USERNAME/Desktop ]; then
682 682
         if [ ! -d /home/$MY_USERNAME/Public ]; then
683
-            mkdir /home/$MY_USERNAME/Public
683
+            mkdir -p /home/$MY_USERNAME/Public/Videos
684
+            mkdir -p /home/$MY_USERNAME/Public/Music
685
+            mkdir -p /home/$MY_USERNAME/Public/Documents
684 686
             echo $'Files within this directory will be publicly visible on the network' > /home/$MY_USERNAME/Public/README.txt
685 687
             chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Public
686 688
             ln -s /home/$MY_USERNAME/Public /home/$MY_USERNAME/Desktop/Public

+ 19
- 0
src/meshavahi 查看文件

@@ -68,6 +68,25 @@ function ipfs_publish {
68 68
 
69 69
     NEW_STAT=$(stat -t $DIR_TO_CHECK)
70 70
 
71
+    # include some subdirectories
72
+    for dir in $DIR_TO_CHECK/*/
73
+    do
74
+        REALLY_NEW_STAT="$NEW_STAT$(stat -t $dir)"
75
+        NEW_STAT="$REALLY_NEW_STAT"
76
+
77
+        for dir2 in "$dir"/*/
78
+        do
79
+            REALLY_NEW_STAT="$NEW_STAT$(stat -t $dir2)"
80
+            NEW_STAT="$REALLY_NEW_STAT"
81
+
82
+            for dir3 in "$dir2"/*/
83
+            do
84
+                REALLY_NEW_STAT="$NEW_STAT$(stat -t $dir3)"
85
+                NEW_STAT="$REALLY_NEW_STAT"
86
+            done
87
+        done
88
+    done
89
+
71 90
     if [ "$OLD_STAT" != "$NEW_STAT" ]; then
72 91
         su -c "echo \$($IPFS_COMMAND add -rq /home/$MY_USERNAME/Public | tail -n 1) > $IPFS_PUBLIC" - $MY_USERNAME
73 92
         echo "$NEW_STAT" > $OLD_STAT_FILE