diff options
| author | makefu <github@syntax-fehler.de> | 2014-03-17 09:27:05 +0100 | 
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2014-03-17 09:27:05 +0100 | 
| commit | 004afecb81c443a4ab459cfd7f4468ad692f6dd7 (patch) | |
| tree | 95c3aa03df3e4a7f26073fd67d8d816a8f395529 /filehooker/root-image/krebs/lib | |
| parent | 50006d90a290a3d3e9c57ed1317062f0500e1890 (diff) | |
add ncdc startup script
Diffstat (limited to 'filehooker/root-image/krebs/lib')
| -rw-r--r-- | filehooker/root-image/krebs/lib/filehooker | 23 | 
1 files changed, 22 insertions, 1 deletions
| diff --git a/filehooker/root-image/krebs/lib/filehooker b/filehooker/root-image/krebs/lib/filehooker index 18376465..90d887bd 100644 --- a/filehooker/root-image/krebs/lib/filehooker +++ b/filehooker/root-image/krebs/lib/filehooker @@ -14,7 +14,9 @@ ncdc_configure_netshare(){      : "${1?provide path to share}"      rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom`      rnd_name="${2:-share_$rnd}" -    info "adding share" +    info "removing old share $rnd_name" +    (echo "/unshare $rnd_name" ) | ncdc_config +    info "adding share $rnd_name ($1)"      (echo "/share $rnd_name $1") | ncdc_config  } @@ -117,3 +119,22 @@ info "enable tor_announce"  systemctl enable tor_announce  systemctl start tor_announce  } + +share_all_partitions(){ +    count=0 +    find /dev -name '[shv]d[a-z][0-9]' | while read disk;do +        size=$(get_disksize $disk) +        if test "$size" -gt "$min_netshare_size"; +        then +          info "trying disk $disk" +          mountpoint=/media/vag$count +          mkdir -p $mountpoint +          umount $mountpoint 2>&1 >/dev/null && info "$mountpoint unmounted" || : +          ! mount $disk $mountpoint && error "cannot mount $disk"  && continue +          : $((count++)) +          ncdc_configure_netshare "$mountpoint" "$(basename $mountpoint)" +        else +          info "skipping $disk" +        fi +    done +} | 
