Update sysutils/filelight to version 20.04.0
[dports.git] / sysutils / e2fsprogs / pkg-install
1 #!/bin/sh
2 set -e
3
4 PKGNAME="$1"
5 MODE="$2" # PRE-INSTALL, POST-INSTALL, DEINSTALL, POST-DEINSTALL
6
7 case "$MODE" in
8 POST-INSTALL)
9         # install fsck tool and wrapper.
10         err=0
11         for i in e2fsck fsck_ext2fs ; do
12                 ln -f ${PKG_PREFIX}/sbin/${i} /sbin 2>/dev/null \
13                 || cp -p ${PKG_PREFIX}/sbin/${i} /sbin \
14                 || err=1
15         done
16         if test $err = 1 ; then
17                 echo '========================================================================'
18                 echo 'Warning: cannot install fsck to /sbin!'
19                 echo 'Requesting ext2fs to be checked from /etc/fstab can cause boot failures!'
20                 echo '========================================================================'
21                 echo ''
22         fi
23         #
24         # install configuration file and update
25         #
26         if test -f ${PKG_PREFIX}/etc/mke2fs.conf; then
27                 if cmp -s ${PKG_PREFIX}/etc/mke2fs.conf.dist \
28                                                 ${PKG_PREFIX}/etc/mke2fs.conf; then
29                         true
30                 else
31                         if grep -q ext4dev ${PKG_PREFIX}/etc/mke2fs.conf ; then
32                                 cp -f -p ${PKG_PREFIX}/etc/mke2fs.conf.dist \
33                                         ${PKG_PREFIX}/etc/mke2fs.conf.e2fsprogs-new
34                                 echo "==========================================================================="
35                                 echo "Warning: installing mke2fs.conf in ${PKG_PREFIX}/etc/mke2fs.conf.e2fsprogs-new"
36                                 echo "Check to see if you need to update your ${PKG_PREFIX}/etc/mke2fs.conf"
37                                 echo "==========================================================================="
38                         else
39                                 mv ${PKG_PREFIX}/etc/mke2fs.conf \
40                                          ${PKG_PREFIX}/etc/mke2fs.conf.e2fsprogs-old
41                                 cp -f -p ${PKG_PREFIX}/etc/mke2fs.conf.dist \
42                                         ${PKG_PREFIX}/etc/mke2fs.conf
43                                 echo "==========================================================================="
44                                 echo "Your mke2fs.conf is too old.  Backing up old version in"
45                                 echo "${PKG_PREFIX}/etc/mke2fs.conf.e2fsprogs-old.  Please check to see"
46                                 echo "if you have any local customizations that you wish to preserve."
47                                 echo "==========================================================================="
48                         fi
49                         echo " "
50                 fi
51         else
52                 cp -f -p ${PKG_PREFIX}/etc/mke2fs.conf.dist \
53                         ${PKG_PREFIX}/etc/mke2fs.conf
54         fi
55         ;;
56 DEINSTALL)
57         rm -f /sbin/fsck_ext2fs /sbin/e2fsck \
58         || echo "Could not remove /sbin/fsck_ext2fs /sbin/e2fsck. Please remove manually."
59         if cmp -s ${PKG_PREFIX}/etc/mke2fs.conf \
60                 ${PKG_PREFIX}/etc/mke2fs.conf.dist
61         then
62                 rm -f ${PKG_PREFIX}/etc/mke2fs.conf
63         else
64                 echo "If and only if you are deleting e2fsprogs forever,"
65                 echo "remember to delete ${PKG_PREFIX}/etc/mke2fs.conf."
66         fi
67         if test -f ${PKG_PREFIX}/etc/e2fsck.conf
68         then
69                 echo "If and only if you are deleting e2fsprogs forever,"
70                 echo "remember to delete ${PKG_PREFIX}/etc/e2fsck.conf."
71         fi
72         ;;
73 PRE-INSTALL|POST-DEINSTALL)
74         true
75         ;;
76 esac