Switch to unified view

a/vagrant/compress.sh b/vagrant/compress.sh
1
#!/bin/bash
1
#!/bin/bash
2
3
#       Licensed to the Apache Software Foundation (ASF) under one
4
#       or more contributor license agreements.  See the NOTICE file
5
#       distributed with this work for additional information
6
#       regarding copyright ownership.  The ASF licenses this file
7
#       to you under the Apache License, Version 2.0 (the
8
#       "License"); you may not use this file except in compliance
9
#       with the License.  You may obtain a copy of the License at
10
#
11
#         http://www.apache.org/licenses/LICENSE-2.0
12
#
13
#       Unless required by applicable law or agreed to in writing,
14
#       software distributed under the License is distributed on an
15
#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
#       KIND, either express or implied.  See the License for the
17
#       specific language governing permissions and limitations
18
#       under the License.
2
19
3
echo 'Cleanup bash history'
20
echo 'Cleanup bash history'
4
unset HISTFILE
21
unset HISTFILE
5
[ -f /root/.bash_history ] && rm /root/.bash_history
22
[ -f /root/.bash_history ] && rm /root/.bash_history
6
[ -f /home/vagrant/.bash_history ] && rm /home/vagrant/.bash_history
23
[ -f /home/vagrant/.bash_history ] && rm /home/vagrant/.bash_history
7
 
24
8
echo 'Cleanup log files'
25
echo 'Cleanup log files'
9
find /var/log -type f | while read f; do echo -ne '' > $f; done;
26
find /var/log -type f | while read f; do echo -ne '' > $f; done;
10
 
27
11
echo 'Whiteout root'
28
echo 'Whiteout root'
12
count=`df --sync -kP / | tail -n1  | awk -F ' ' '{print $4}'`; 
29
count=`df --sync -kP / | tail -n1  | awk -F ' ' '{print $4}'`;
13
let count--
30
let count--
14
dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count;
31
dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count;
15
rm /tmp/whitespace;
32
rm /tmp/whitespace;
16
 
33
17
echo 'Whiteout /boot'
34
echo 'Whiteout /boot'
18
count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'`;
35
count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'`;
19
let count--
36
let count--
20
dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count;
37
dd if=/dev/zero of=/boot/whitespace bs=1024 count=$count;
21
rm /boot/whitespace;
38
rm /boot/whitespace;