Statistics
| Branch: | Tag: | Revision:

root / image_creator / os_type / slackware.py @ 6df939f7

History | View | Annotate | Download (2.2 kB)

1 ae48a082 Nikos Skalkotos
# Copyright 2012 GRNET S.A. All rights reserved.
2 ae48a082 Nikos Skalkotos
#
3 ae48a082 Nikos Skalkotos
# Redistribution and use in source and binary forms, with or
4 ae48a082 Nikos Skalkotos
# without modification, are permitted provided that the following
5 ae48a082 Nikos Skalkotos
# conditions are met:
6 ae48a082 Nikos Skalkotos
#
7 ae48a082 Nikos Skalkotos
#   1. Redistributions of source code must retain the above
8 ae48a082 Nikos Skalkotos
#      copyright notice, this list of conditions and the following
9 ae48a082 Nikos Skalkotos
#      disclaimer.
10 ae48a082 Nikos Skalkotos
#
11 ae48a082 Nikos Skalkotos
#   2. Redistributions in binary form must reproduce the above
12 ae48a082 Nikos Skalkotos
#      copyright notice, this list of conditions and the following
13 ae48a082 Nikos Skalkotos
#      disclaimer in the documentation and/or other materials
14 ae48a082 Nikos Skalkotos
#      provided with the distribution.
15 ae48a082 Nikos Skalkotos
#
16 ae48a082 Nikos Skalkotos
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 ae48a082 Nikos Skalkotos
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 ae48a082 Nikos Skalkotos
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 ae48a082 Nikos Skalkotos
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 ae48a082 Nikos Skalkotos
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 ae48a082 Nikos Skalkotos
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 ae48a082 Nikos Skalkotos
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 ae48a082 Nikos Skalkotos
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 ae48a082 Nikos Skalkotos
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 ae48a082 Nikos Skalkotos
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 ae48a082 Nikos Skalkotos
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 ae48a082 Nikos Skalkotos
# POSSIBILITY OF SUCH DAMAGE.
28 ae48a082 Nikos Skalkotos
#
29 ae48a082 Nikos Skalkotos
# The views and conclusions contained in the software and
30 ae48a082 Nikos Skalkotos
# documentation are those of the authors and should not be
31 ae48a082 Nikos Skalkotos
# interpreted as representing official policies, either expressed
32 ae48a082 Nikos Skalkotos
# or implied, of GRNET S.A.
33 ae48a082 Nikos Skalkotos
34 f165adc0 Nikos Skalkotos
from image_creator.os_type.linux import Linux, sysprep
35 8c574358 Nikos Skalkotos
36 8c574358 Nikos Skalkotos
37 8c574358 Nikos Skalkotos
class Slackware(Linux):
38 88f83027 Nikos Skalkotos
    """OS class for Slackware Linux"""
39 f165adc0 Nikos Skalkotos
    @sysprep()
40 88f83027 Nikos Skalkotos
    def cleanup_log(self, print_header=True):
41 88f83027 Nikos Skalkotos
        """Empty all files under /var/log"""
42 88f83027 Nikos Skalkotos
43 88f83027 Nikos Skalkotos
        if print_header:
44 88f83027 Nikos Skalkotos
            self.out.output('Emptying all files under /var/log')
45 88f83027 Nikos Skalkotos
46 3b2f6619 Nikos Skalkotos
        # In slackware the metadata about installed packages are
47 3b2f6619 Nikos Skalkotos
        # stored in /var/log/packages. Clearing all /var/log files
48 3b2f6619 Nikos Skalkotos
        # will destroy the package management system.
49 f99fe99d Nikos Skalkotos
        self.foreach_file('/var/log', self.g.truncate, ftype='r',
50 f99fe99d Nikos Skalkotos
                          exclude='/var/log/packages')
51 8c574358 Nikos Skalkotos
52 8c574358 Nikos Skalkotos
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :