force constant cpu frequencies (2)
[debian6500.git] / master / opt / cluster / bin / create_root_tarball.sh
CommitLineData
4e802319 1#!/bin/bash
2
3# ============================================================================
4# Copyright (C) THALES. All rights reserved
5# Author: Laurent Mazet
6# Date : 20/02/2014
7# ============================================================================
8
9# TODO
10# *
11
12PROGNAME=$(basename $0)
13TFTP=/opt/tftp
14EXCLUDE=/tmp/$PROGNAME-exclude-$$
15IMAGE=$TFTP/root.tgz
16TMPLOG=/tmp/$PROGNAME-$$.log
17VER=2.0
18
19# help function
20
21function usage () {
22 echo "usage: $PROGNAME [-h] [-v]"
23 echo " -h: help message"
24 echo " -v: version message"
25 exit $@
26}
27
28# formating functions
29
30function title () { echo -e "\033[0;1m$*\033[0;0m"; }
31function pass () { echo -e "\033[1;32m$*\033[0;0m"; }
32function warn () { echo -e "\033[1;33m$*\033[0;0m"; }
33function fail () { echo -e "\033[1;31m$*\033[0;0m"; }
34# check command
35
36function check () {
37 echo -n "$@: "
38 { eval $@; } >&$TMPLOG && pass OK || { fail KO; cat $TMPLOG; ERR=yes; }
39 rm -f $TMPLOG
40 test ! "$TEST" = yes
41}
42
43# argument processing
44
45while [ $# -gt 0 ]; do
46 case "$1" in
47 -h) usage 0;;
48 -v) echo "$PROGNAME: version $VER"; exit;;
49 *) echo "unknown argument ($1)"; exit 1;;
50 esac
51 shift
52done
53
54# create exclude list
55cat - <<EOF > $EXCLUDE
56backup
57boot
58dev/*
59dump
60etc/.git
61etc/udev/rules.d/70-persistent-net.rules
62home
63lost+found
85025af4 64media/*
4e802319 65opt/*
66proc/*
67root/*
68run/*
69sys/*
70tmp/*
71trc6500_list_patched_files.txt
72usr/share/doc
73usr/share/i18n
74usr/share/info
75usr/share/locale
76usr/share/man
77usr/share/zoneinfo
78var/backups/*
79var/cache/apt/*
80var/cache/debconf/*
81var/cache/fontconfig/*
82var/cache/man/*
83var/lib/apt
84var/lib/aptitude
85var/lib/dpkg
86var/lib/samba/*
87var/lock/*
88var/log/*
89var/run/*
90EOF
91check test -f $EXCLUDE
92
93# checks
94[ -f $IMAGE ] && check rm -f $IMAGE
95_OLDPWD=$(pwd)
96cd /
97check tar czf $IMAGE --exclude-from $EXCLUDE .
98cd $_OLDPWD
99
100# clean exclude list
101check rm -f $EXCLUDE
102exit 0