bdf6058e1a0ef1a41005c04570805388aec3b67f
[lxc-reference.git] / initscript / lxc-reference
1 #!/bin/bash
2 # chkconfig: 345 20 80
3 # description: Create BTRFS subvolumes for LXC reference images.
4 #
5
6
7 case "$1" in
8     start|restart|reload)
9         ;;
10     force)
11         FORCE=true;;
12     stop|status)
13         exit 0
14         ;;
15     *)
16         echo $"Usage: $0 {start|stop|restart|reload|status|force}"
17         exit 1
18         ;;
19 esac
20
21 # Source function library
22 . /etc/init.d/functions
23
24 VERSION=`yum info lxc-reference | grep Version | awk '{ print $3; }'`
25
26 if [ -f /vservers/lxc-reference-${VERSION}.tgz ]; then
27     mkdir -p /vservers/.lvref
28     btrfs subvolume create /vservers/.lvref/lxc-f14-x86_64
29     btrfs subvolume create /vservers/.lvref/lxc-squeeze-x86_64
30     tar zxf /vservers/lxc-reference-${VERSION}.tgz -C /vservers/
31     rm -rf /vservers/lxc-reference-${VERSION}.tgz
32 fi
33
34 exit 0
35