desktop/cinstall/cinstall.install

162 lines
4.8 KiB
Plaintext
Raw Normal View History

2010-06-22 21:15:23 +08:00
post_install() {
if [ -e "/etc/chakra/updates.conf" ] ; then
. /etc/chakra/updates.conf
if [ "$UPDATE_XDG_ICON_DB" = "yes" ]; then
/usr/bin/chakra-update-icons
fi
else
echo " > WARNING"
echo " The package kde-common seems not to be installed,"
echo " this can possibly break the installation. Just install it"
echo " manually after this installation/update, run the following"
echo " commands and restart KDE afterwards:"
echo " sudo chakra-config-updater"
echo " kbuildsycoca4"
echo " "
fi
echo "Create group bundle"
if [ "Group: `grep bundle /etc/group`" = "Group: " ] ; then
groupadd bundle
else
echo "Group bundle already exists"
fi
echo "Adding all existing users to group bundle"
for i in `cat /etc/passwd | grep /home | cut -d: -f1` ; do
echo " - adding user $i"
usermod -a -G bundle $i
done
echo "Mod sudoers file"
if [ "sudoers: `grep bundle /etc/sudoers`" = "sudoers: " ] ; then
2010-06-26 03:46:11 +08:00
echo "%bundle ALL=NOPASSWD: /bin/mount -o loop -t squashfs *" >> /etc/sudoers
2010-08-10 19:08:35 +08:00
echo "%bundle ALL=NOPASSWD: /bin/mount -o loop -t ext4 *" >> /etc/sudoers
echo "%bundle ALL=NOPASSWD: /bin/umount *" >> /etc/sudoers
echo "ensure correct sudoers permissions"
chmod -v 0440 /etc/sudoers
elif [ "sudoers: `grep "%bundle ALL=NOPASSWD: /bin/umount" /etc/sudoers`" = "sudoers: " ] ; then
echo "%bundle ALL=NOPASSWD: /bin/mount -o loop -t ext4 *" >> /etc/sudoers
echo "%bundle ALL=NOPASSWD: /bin/umount *" >> /etc/sudoers
2010-06-22 21:15:23 +08:00
echo "ensure correct sudoers permissions"
chmod -v 0440 /etc/sudoers
else
echo "sudoers file already modded"
fi
2010-06-26 06:33:12 +08:00
2010-08-10 19:08:35 +08:00
mkdir -p /etc/gre.d &>/dev/null
chmod 775 /etc/gre.d &>/dev/null
chown -R root:bundle /etc/gre.d &>/dev/null
2010-07-21 05:00:37 +08:00
2010-08-10 19:08:35 +08:00
mkdir -p /etc/cb.conf.d &>/dev/null
chmod 775 /etc/cb.conf.d &>/dev/null
chown -R root:bundle /etc/cb.conf.d &>/dev/null
2010-07-19 19:02:16 +08:00
2010-06-26 06:33:12 +08:00
echo "update mime-database"
2010-07-02 17:42:49 +08:00
update-mime-database /usr/share/mime &>/dev/null
2010-06-22 21:15:23 +08:00
}
post_upgrade() {
if [ -e "/etc/chakra/updates.conf" ] ; then
. /etc/chakra/updates.conf
if [ "$UPDATE_XDG_ICON_DB" = "yes" ]; then
/usr/bin/chakra-update-icons
fi
else
echo " > WARNING"
echo " The package kde-common seems not to be installed,"
echo " this can possibly break the installation. Just install it"
echo " manually after this installation/update, run the following"
echo " commands and restart KDE afterwards:"
echo " sudo chakra-config-updater"
echo " kbuildsycoca4"
echo " "
fi
echo "Create group bundle"
if [ "Group: `grep bundle /etc/group`" = "Group: " ] ; then
groupadd bundle
else
echo "Group bundle already exists"
fi
echo "Adding all existing users to group bundle"
for i in `cat /etc/passwd | grep /home | cut -d: -f1` ; do
echo " - adding user $i"
usermod -a -G bundle $i
done
echo "Mod sudoers file"
if [ "sudoers: `grep bundle /etc/sudoers`" = "sudoers: " ] ; then
2010-06-26 05:43:57 +08:00
echo "%bundle ALL=NOPASSWD: /bin/mount -o loop -t squashfs *" >> /etc/sudoers
2010-08-10 19:08:35 +08:00
echo "%bundle ALL=NOPASSWD: /bin/mount -o loop -t ext4 *" >> /etc/sudoers
echo "%bundle ALL=NOPASSWD: /bin/umount *" >> /etc/sudoers
echo "ensure correct sudoers permissions"
chmod -v 0440 /etc/sudoers
elif [ "sudoers: `grep "%bundle ALL=NOPASSWD: /bin/umount" /etc/sudoers`" = "sudoers: " ] ; then
echo "%bundle ALL=NOPASSWD: /bin/mount -o loop -t ext4 *" >> /etc/sudoers
echo "%bundle ALL=NOPASSWD: /bin/umount *" >> /etc/sudoers
2010-06-22 21:15:23 +08:00
echo "ensure correct sudoers permissions"
chmod -v 0440 /etc/sudoers
else
echo "sudoers file already modded"
fi
2010-06-26 06:33:12 +08:00
2010-08-10 19:08:35 +08:00
mkdir -p /etc/gre.d &>/dev/null
2010-07-21 05:00:37 +08:00
chmod 775 /etc/gre.d &>/dev/null
chown -R root:bundle /etc/gre.d &>/dev/null
2010-08-10 19:08:35 +08:00
echo "clean /etc/gre.d"
rm /etc/gre.d/* -rv
mkdir -p /etc/cb.conf.d &>/dev/null
2010-07-21 05:00:37 +08:00
chmod 775 /etc/cb.conf.d &>/dev/null
chown -R root:bundle /etc/cb.conf.d &>/dev/null
2010-07-19 19:02:16 +08:00
2010-08-10 19:08:35 +08:00
echo "clean /etc/cb.conf.d"
rm /etc/cb.conf.d/* -rv
2010-06-26 06:33:12 +08:00
echo "update mime-database"
2010-07-02 17:42:49 +08:00
update-mime-database /usr/share/mime &>/dev/null
2010-06-22 21:15:23 +08:00
}
post_remove() {
if [ -e "/etc/chakra/updates.conf" ] ; then
. /etc/chakra/updates.conf
if [ "$UPDATE_XDG_ICON_DB" = "yes" ]; then
/usr/bin/chakra-update-icons
fi
else
echo " > WARNING"
echo " The package kde-common seems not to be installed,"
echo " this can possibly break the installation. Just install it"
echo " manually after this installation/update, run the following"
echo " commands and restart KDE afterwards:"
echo " sudo chakra-config-updater"
echo " kbuildsycoca4"
echo " "
fi
2010-08-10 19:08:35 +08:00
rm /etc/gre.d -r
rm /etc/cb.conf.d -r
2010-06-22 21:15:23 +08:00
}
op=$1
shift
2010-06-25 03:11:26 +08:00
$op $*