]> git.pld-linux.org Git - packages/lxc.git/commitdiff
Release 3. Fixes in init scripts. auto/th/lxc-1.0.7-3
authorMateusz Korniak <matkor@pld-linux.org>
Wed, 25 Feb 2015 12:20:20 +0000 (13:20 +0100)
committerMateusz Korniak <matkor@pld-linux.org>
Wed, 25 Feb 2015 12:20:20 +0000 (13:20 +0100)
lxc.init
lxc.spec
lxc_macvlan.init

index 0b8a0a0e355ad0f618f46c044d7ac3897176e893..2a134e22200bf9e8dd326bc9dde48470db997fef 100755 (executable)
--- a/lxc.init
+++ b/lxc.init
@@ -41,7 +41,9 @@ OPTIONS=
 
 # STOPOPTS are stop options.  The can be used for anything else to stop.
 #      If you want to kill containers fast, use -k
-STOPOPTS="-a -s"
+# --all         list all auto-started containers (ignore groups)
+# --shutdown    shutdown the containers instead of starting them
+STOPOPTS="--all --shutdown"
 
 # Source function library.
 test ! -r "$sysconfdir"/rc.d/init.d/functions ||
@@ -98,16 +100,9 @@ case "$1" in
        fi
 
        # Start containers
-       ## wait_for_bridge
-       # Start autoboot containers first then the NULL group "onboot,".
-       ## action $"Starting LXC autoboot containers: " /usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS
-       ## msg_starting lxc
-       ## echo "DEBUG: Launch: /usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS"
-       CONTAINERS_LIST=`/usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS --list`
-
-        ## run_cmd "Starting LXC containers ( $CONTAINERS_LIST ) from groups: $BOOTGROUPS " /usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS 
-        run_cmd $(nls "Starting LXC containers (%s) from groups: %s " $CONTAINERS_LIST $BOOTGROUPS) /usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS
-
+       CONTAINERS_LIST=`/usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS --list | tr '\n' ' '`
+       # echo "DEBUG: CONTAINERS_LIST=${CONTAINERS_LIST}"
+        run_cmd "$(nls "Starting LXC containers (%s) from groups: %s " "$CONTAINERS_LIST" "$BOOTGROUPS")" /usr/bin/lxc-autostart $OPTIONS $BOOTGROUPS
        touch "$localstatedir"/lock/subsys/lxc
        ;;
   stop)
@@ -119,12 +114,8 @@ case "$1" in
        # The stop is serialized and can take excessive time.  We need to avoid
        # delaying the system shutdown / reboot as much as we can since it's not
        # parallelized...  Even 5 second timout may be too long.
-       ## action $"Stopping LXC containers: " "$bindir"/lxc-autostart $STOPOPTS $SHUTDOWNDELAY
-       CONTAINERS_LIST=`/usr/bin/lxc-autostart $STOPOPTS --list`
-
-       ## run_cmd "Stopping running LXC containers ($CONTAINERS_LIST) "   "$bindir"/lxc-autostart $STOPOPTS $SHUTDOWNDELAY
-       run_cmd $(nls "Stopping running LXC containers (%s) " $CONTAINERS_LIST) /usr/bin/lxc-autostart $STOPOPTS $SHUTDOWNDELAY
-
+       CONTAINERS_LIST=`/usr/bin/lxc-autostart $STOPOPTS --list | tr '\n' ' '`
+       run_cmd "$(nls "Stopping running LXC containers (%s) " "$CONTAINERS_LIST")" /usr/bin/lxc-autostart $STOPOPTS $SHUTDOWNDELAY
        rm -f "$localstatedir"/lock/subsys/lxc
        ;;
   restart|reload|force-reload)
@@ -132,7 +123,7 @@ case "$1" in
        $0 start
        ;;
   status)
-       lxc-ls --fancy   # NOTE: python3-lxc is needed for lxc-ls
+       lxc-ls --fancy  --fancy-format name,state,pid,ipv4,ipv6,memory,ram,swap    # NOTE: python3-lxc is needed for lxc-ls
        ;;
   *)
        echo $"Usage: $0 {start|stop|restart|reload|force-reload}"
index 1c0e53fd9dc5c505cede7a268107a04ef6dd2ba0..d53cc13b95a96d760582054b979c1bad4f170a1e 100644 (file)
--- a/lxc.spec
+++ b/lxc.spec
@@ -13,7 +13,7 @@ Summary:      Linux Containers userspace tools
 Summary(pl.UTF-8):     Narzędzia do kontenerów linuksowych (LXC)
 Name:          lxc
 Version:       1.0.7
-Release:       2
+Release:       3
 License:       LGPL v2.1+
 Group:         Applications/System
 Source0:       https://www.linuxcontainers.org/downloads/%{name}-%{version}.tar.gz
@@ -42,6 +42,9 @@ BuildRequires:        rpmbuild(macros) >= 1.612
 BuildRequires: sed >= 4.0
 Requires:      rc-scripts >= 0.4.6
 Requires:      which
+Requires:      iproute2
+Requires(post,preun):  /sbin/chkconfig
+Requires(post):        /sbin/ldconfig
 Suggests:      gnupg
 Suggests:      gnupg-plugin-keys_curl
 Suggests:      gnupg-plugin-keys_hkp
@@ -190,12 +193,11 @@ install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/lxc_macvlan
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post  -p /sbin/ldconfig
+%post  
+/sbin/ldconfig
 /sbin/chkconfig --add lxc
 /sbin/chkconfig --add lxc_macvlan
 
-# %service lxc restart
-
 %preun
 if [ "$1" = "0" ]; then
        %service lxc stop
index f2f9b10da34989001b252f603026c333e8e82425..ea703260981b22a95e6bf6f583386832c2c1fffe 100755 (executable)
@@ -39,12 +39,14 @@ fi
 # If not defined MACVLAN_HWADDRESS, calculate it from MACVLAN_ADDRESS
 if [ -z "$MACVLAN_HWADDRESS" ]; then 
     MACVLAN_HWADDRESS=`echo $MACVLAN_ADDRESS | awk -F "/" '{print $1}' | awk -F "." '{ printf "00:16:3e:%x:%x:%x\n", $2, $3, $4 }'`
-    echo "MACVLAN_HWADDRESS not set, using calculated from MACVLAN_ADDRESS=${MACVLAN_ADDRESS} value: ${MACVLAN_HWADDRESS}"; 
+    # TODO: Print on start() only
+    # echo "MACVLAN_HWADDRESS not set, using calculated from MACVLAN_ADDRESS=${MACVLAN_ADDRESS} value: ${MACVLAN_HWADDRESS}"; 
 fi
 
 
 start() {
         msg_starting "LXC macvlan interface"
+       # set -x
        ip link add link $MACVLAN_DEV name $MACVLAN_NAME address $MACVLAN_HWADDRESS type macvlan mode bridge
        ip link set $MACVLAN_NAME up
        ip address add $MACVLAN_ADDRESS brd + dev $MACVLAN_NAME
@@ -57,12 +59,17 @@ start() {
 
 stop() {
         msg_stopping "LXC macvlan interface"
+       # set -x
        ip link set $MACVLAN_NAME down
        ip link del $MACVLAN_NAME
         RETVAL=$?
        [ $RETVAL -eq 0 ] && ok || fail
 }
 
+status() {
+       ip addr show $MACVLAN_NAME 
+}
+
 
 RETVAL=0
 
@@ -80,6 +87,7 @@ case "$1" in
        start
        ;;
   status)
+       status
        ;;
   *)
 
This page took 0.061557 seconds and 4 git commands to generate.