mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-10-31 08:21:49 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			678 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			678 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/sbin/openrc-run
 | |
| 
 | |
| WORK_DIR="/" # btrfs filesytem root directory
 | |
| DB_SIZE=8 # this default setting uses about 140M of memory
 | |
| 
 | |
| BEESSTATUS=/run/$SVCNAME/$SVCNAME.status
 | |
| BEESHOME="$WORK_DIR/.beeshome"
 | |
| DB_PATH="$BEESHOME/beeshash.dat"
 | |
| NEW_SIZE=$(expr $DB_SIZE \* 16777216)
 | |
| name=$SVCNAME
 | |
| command=/bin/$SVCNAME
 | |
| command_args="$WORK_DIR"
 | |
| command_background=yes
 | |
| pidfile=/run/$SVCNAME/$SVCNAME.pid
 | |
| export BEESSTATUS
 | |
| 
 | |
| start_pre() {
 | |
| 	checkpath -d /run/$SVCNAME
 | |
| 	if [ ! -d "$BEESHOME" ]; then
 | |
| 		btrfs sub cre "$BEESHOME"
 | |
| 	fi	
 | |
| 	touch "$DB_PATH"
 | |
| 	OLD_SIZE="$(wc -c < "$DB_PATH" | sed 's/\t/ /g' | cut -d' ' -f1)"
 | |
| 	if [ "$OLD_SIZE" != "$NEW_SIZE" ]; then
 | |
| 		truncate -s $NEW_SIZE $DB_PATH
 | |
| 	fi
 | |
| }
 |