Restart lxc-reference after installation.
[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 # Check if we are in the build environment
22 mount | grep 'planetlab-vservers' > /dev/null
23 RETVAL=$?
24 [ $RETVAL -ne 0 ] && exit 0
25
26 # Source function library
27 . /etc/init.d/functions
28
29 VERSION=`yum info lxc-reference | grep Version | awk '{ print $3; }'`
30
31 if [ -f /vservers/lxc-reference-${VERSION}.tgz ]; then
32     mkdir -p /vservers/.lvref
33     btrfs subvolume create /vservers/.lvref/lxc-f14-x86_64
34     btrfs subvolume create /vservers/.lvref/lxc-squeeze-x86_64
35     tar zxf /vservers/lxc-reference-${VERSION}.tgz -C /vservers/
36     rm -rf /vservers/lxc-reference-${VERSION}.tgz
37 fi
38
39 exit 0
40