Changeset 8947


Ignore:
Timestamp:
2007-09-22T15:47:20+02:00 (9 years ago)
Author:
rwhitby
Message:

base-files: Added support for swap configuration in /etc/config/fstab

Location:
trunk/package/base-files
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/Makefile

    r8916 r8947  
    1111 
    1212PKG_NAME:=base-files 
    13 PKG_RELEASE:=11 
     13PKG_RELEASE:=12 
    1414 
    1515PKG_FILE_DEPEND:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ 
  • trunk/package/base-files/files/etc/config/fstab

    r8916 r8947  
    55        option options  rw,sync 
    66        option enabled  0 
     7 
     8config swap 
     9        option device   /dev/sda2 
     10        option enabled  0 
  • trunk/package/base-files/files/etc/init.d/fstab

    r8916 r8947  
    2121} 
    2222 
     23do_swapon() { 
     24        local cfg="$1" 
     25        config_get device "$cfg" device 
     26        [ -n "device" ] || return 0 
     27        config_get_bool enabled "$cfg" "enabled" '1' 
     28        [ "$enabled" -gt 0 ] && [ -x /usr/sbin/swapon ] && { 
     29          /usr/sbin/swapon $device 
     30        } 
     31} 
     32 
    2333do_unmount() { 
    2434        local cfg="$1" 
     
    3141} 
    3242         
     43do_swapoff() { 
     44        local cfg="$1" 
     45        config_get device "$cfg" device 
     46        [ -n "device" ] || return 0 
     47        config_get_bool enabled "$cfg" "enabled" '1' 
     48        [ "$enabled" -gt 0 ] && [ -x /usr/sbin/swapoff ] && { 
     49          /usr/sbin/swapoff $device 
     50        } 
     51} 
     52 
    3353start() { 
    3454        config_load fstab 
    3555        config_foreach do_mount mount 
     56        config_foreach do_swapon swap 
    3657} 
    3758 
     
    3960        config_load fstab 
    4061        config_foreach do_unmount mount 
     62        config_foreach do_swapoff swap 
    4163} 
    4264 
Note: See TracChangeset for help on using the changeset viewer.