#
# SolutionIP distribution file
#

dist_name    = "SolutionIP"
dist_version = "9.5.3.5"

dist_postinstall = "init.sh"

dist_initrd_config = "/etc/sysconfig/kernel"

dist_upgrade = False


#
# Package selections
#

addSelection ("base",
              files = "base.sel",
              description = "Base SolutionIP system"
)

#
# File containing list of obsolete packages
#
dist_obsoletefile = "obsoletepackages"

#
# Partition layout
#

# Preferred data filesystem
#dist_datafs = 'reiser'
dist_datafs = 'ext4'
# The -ff is required for reiserfs
#dist_fsopts = '-ff --hash r5 --format 3.6'
dist_fsopts = ''

swapsize = hw_data['memory']['megabytes']*2
espsize = 300 # MB

# Cap swap partitions at 2G
if swapsize > 2048:
    swapsize = 2048

addDataPart ('/', partnum = 1, size = '-%sMB' % (swapsize+ espsize)) # Whole disk, less swapsize and espsize
addSwapPart (partnum = 2, size = '%s MB' % swapsize)
#addESPPart (partnum = 3, size = '-1')


#
# Users and groups
#

# Reenable when this works properly
#rootPassword('rootdefault')


#
# SolutionIP config file location
#
dist_config_location = "/usr/local/SolutionInc/etc/templates/latest_config_file"

#
# Scripts for upgrading SolutionIP config files
#
dist_config_upgrades = (
    ('6.1', r'''
# Convert quotes from " to '
s = re.sub(r'(?m)(^[a-zA-Z_0-9]+=)"', r"\1'", s)
s = re.sub(r'"\n', r"'\n", s)
'''),

    ('6.2', r'''
# The NUT 'newapc' driver was deprecated by 'apcsmart' in 2.0
s = re.sub(r"(?m)(^SMARTUPS_MODEL=')newapc'", r"\1apcsmart'", s)
'''),

    ('6.2', r'''
# The NUT 'usbhid-ups' replaced 'hidups' in 2.2
s = re.sub(r"(?m)(^SMARTUPS_MODEL=')hidups'", r"\1usbhid-ups'", s)
'''),
)
