[go: up one dir, main page]

File: create_smalldb

package info (click to toggle)
libkarma 0.1.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 676 kB
  • sloc: ansic: 6,224; sh: 328; makefile: 229; cs: 170
file content (30 lines) | stat: -rwxr-xr-x 761 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
 if [ $# -lt 1 ] || [ "${1%elp}" = "-h" ] || [ "${1%elp}" = "--h" ] ; then
   echo "\
   Usage: ${0##*/} [-h] karma_mount_point

   Mounts the RK on karma_mount_point and creates an empty index file 
   (var/smalldb), along with a fids directory (fids0/_00000), if needed.
 "
   exit 0
 fi
#
WASMOUNTED=1
if mount $1 2>/dev/null ; then
   WASMOUNTED=0
   echo -n Mounting the RK on $1" "
   while mount $1 2>/dev/null ; do sleep 1 ; echo -n \. ; done
   echo " "mounted!
fi
mkdir -p $1/{var,fids0/_00000}
if [ -f $1/var/smalldb ] ; then
   echo The file $1/var/smalldb already existed.
else
   echo Creating empty $1/var/smalldb
   touch $1/var/smalldb
fi
if [ $WASMOUNTED == 0 ] ; then 
   echo -n Unmounting $1 ..." "
   umount $1
   echo done!
fi