2011-03-11 01:42:42 +01:00
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
|
|
|
|
# Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
%{!?version: %define version %(cat version_vm)}
|
|
|
|
|
|
|
|
Name: qubes-core-commonvm
|
|
|
|
Version: %{version}
|
2011-03-16 19:14:42 +01:00
|
|
|
Release: 1%{dist}
|
2011-03-11 01:42:42 +01:00
|
|
|
Summary: The Qubes core files for any VM
|
|
|
|
|
|
|
|
Group: Qubes
|
|
|
|
Vendor: Invisible Things Lab
|
|
|
|
License: GPL
|
|
|
|
URL: http://www.qubes-os.org
|
|
|
|
Requires: /usr/bin/xenstore-read
|
2011-03-15 23:05:48 +01:00
|
|
|
Requires: fedora-release
|
2011-06-12 00:50:39 +02:00
|
|
|
Requires: yum-plugin-post-transaction-actions
|
2011-03-29 11:02:29 +02:00
|
|
|
BuildRequires: xen-devel
|
2011-03-11 01:42:42 +01:00
|
|
|
|
|
|
|
%define _builddir %(pwd)/common
|
|
|
|
|
|
|
|
%description
|
|
|
|
The Qubes core files for installation inside a Qubes VM.
|
|
|
|
|
2011-03-15 19:47:26 +01:00
|
|
|
%build
|
|
|
|
make
|
|
|
|
|
2011-03-11 01:42:42 +01:00
|
|
|
%pre
|
|
|
|
|
|
|
|
if [ "$1" != 1 ] ; then
|
|
|
|
# do this whole %pre thing only when updating for the first time...
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes
|
|
|
|
if [ -e $RPM_BUILD_ROOT/etc/fstab ] ; then
|
|
|
|
mv $RPM_BUILD_ROOT/etc/fstab $RPM_BUILD_ROOT/var/lib/qubes/fstab.orig
|
|
|
|
fi
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc
|
|
|
|
cp fstab $RPM_BUILD_ROOT/etc/fstab
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
|
|
|
cp qubes_core $RPM_BUILD_ROOT/etc/init.d/
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
|
|
|
|
cp iptables $RPM_BUILD_ROOT/etc/sysconfig/
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/yum.repos.d
|
2011-04-06 13:59:43 +02:00
|
|
|
cp qubes%{dist}.repo $RPM_BUILD_ROOT/etc/yum.repos.d
|
2011-04-04 11:22:32 +02:00
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/etc/pki/rpm-gpg
|
|
|
|
install -m 644 RPM-GPG-KEY-qubes* $RPM_BUILD_ROOT/etc/pki/rpm-gpg/
|
2011-03-15 19:47:26 +01:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/sbin
|
|
|
|
cp qubes_serial_login $RPM_BUILD_ROOT/sbin
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/bin
|
2011-06-06 02:37:55 +02:00
|
|
|
cp xenstore-watch $RPM_BUILD_ROOT/usr/bin/xenstore-watch-qubes
|
2011-03-11 01:42:42 +01:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc
|
2011-03-15 19:47:26 +01:00
|
|
|
cp serial.conf $RPM_BUILD_ROOT/var/lib/qubes/
|
2011-04-23 02:31:54 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/udev/rules.d
|
2011-07-09 11:46:34 +02:00
|
|
|
cp qubes_network.rules $RPM_BUILD_ROOT/etc/udev/rules.d/99-qubes_network.rules
|
2011-04-23 02:31:54 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes/
|
|
|
|
cp setup_ip $RPM_BUILD_ROOT/usr/lib/qubes/
|
2011-06-22 00:44:48 +02:00
|
|
|
cp qubes_download_dom0_updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
2011-06-12 00:50:39 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/yum/post-actions
|
|
|
|
cp qubes_trigger_sync_appmenus.action $RPM_BUILD_ROOT/etc/yum/post-actions/
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
|
|
|
|
cp qubes_trigger_sync_appmenus.sh $RPM_BUILD_ROOT/usr/lib/qubes/
|
2011-06-22 00:44:48 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/dom0-updates
|
2011-03-11 01:42:42 +01:00
|
|
|
|
2011-07-02 19:11:15 +02:00
|
|
|
install -D qubes_core.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/qubes_core.modules
|
|
|
|
|
2011-06-30 01:07:47 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/lib/firmware
|
|
|
|
ln -s /lib/modules/firmware $RPM_BUILD_ROOT/lib/firmware/updates
|
|
|
|
|
2011-03-11 01:42:42 +01:00
|
|
|
%triggerin -- initscripts
|
|
|
|
cp /var/lib/qubes/serial.conf /etc/init/serial.conf
|
|
|
|
|
|
|
|
%post
|
|
|
|
|
2011-04-19 00:11:45 +02:00
|
|
|
# disable some Upstart services
|
|
|
|
for F in plymouth-shutdown prefdm splash-manager start-ttys tty ; do
|
|
|
|
if [ -e /etc/init/$F.conf ]; then
|
|
|
|
mv -f /etc/init/$F.conf /etc/init/$F.conf.disabled
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
remove_ShowIn () {
|
|
|
|
if [ -e /etc/xdg/autostart/$1.desktop ]; then
|
|
|
|
sed -i '/^\(Not\|Only\)ShowIn/d' /etc/xdg/autostart/$1.desktop
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# don't want it at all
|
|
|
|
for F in abrt-applet deja-dup-monitor imsettings-start krb5-auth-dialog pulseaudio restorecond sealertauto ; do
|
|
|
|
if [ -e /etc/xdg/autostart/$F.desktop ]; then
|
|
|
|
remove_ShowIn $F
|
|
|
|
echo 'NotShowIn=QUBES' >> /etc/xdg/autostart/$F.desktop
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# don't want it in DisposableVM
|
|
|
|
for F in gcm-apply ; do
|
|
|
|
if [ -e /etc/xdg/autostart/$F.desktop ]; then
|
|
|
|
remove_ShowIn $F
|
|
|
|
echo 'NotShowIn=DisposableVM' >> /etc/xdg/autostart/$F.desktop
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2011-04-20 00:56:58 +02:00
|
|
|
# want it in AppVM only
|
2011-04-19 00:11:45 +02:00
|
|
|
for F in gnome-keyring-gpg gnome-keyring-pkcs11 gnome-keyring-secrets gnome-keyring-ssh gnome-settings-daemon user-dirs-update-gtk gsettings-data-convert ; do
|
|
|
|
if [ -e /etc/xdg/autostart/$F.desktop ]; then
|
|
|
|
remove_ShowIn $F
|
2011-04-20 00:56:58 +02:00
|
|
|
echo 'OnlyShowIn=GNOME;AppVM;' >> /etc/xdg/autostart/$F.desktop
|
2011-04-19 00:11:45 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# remove existing rule to add own later
|
2011-04-20 00:56:58 +02:00
|
|
|
for F in gpk-update-icon nm-applet ; do
|
2011-04-19 00:11:45 +02:00
|
|
|
remove_ShowIn $F
|
|
|
|
done
|
|
|
|
|
2011-04-20 00:56:58 +02:00
|
|
|
echo 'OnlyShowIn=GNOME;UpdateableVM;' >> /etc/xdg/autostart/gpk-update-icon.desktop || :
|
2011-04-19 00:11:45 +02:00
|
|
|
echo 'OnlyShowIn=GNOME;NetVM;' >> /etc/xdg/autostart/nm-applet.desktop || :
|
2011-04-07 12:40:19 +02:00
|
|
|
|
2011-05-12 19:15:24 +02:00
|
|
|
usermod -p '' root
|
2011-03-11 01:42:42 +01:00
|
|
|
if [ "$1" != 1 ] ; then
|
|
|
|
# do this whole %post thing only when updating for the first time...
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -f /var/lib/qubes/serial.orig ] ; then
|
|
|
|
cp /etc/init/serial.conf /var/lib/qubes/serial.orig
|
|
|
|
fi
|
|
|
|
|
|
|
|
#echo "--> Disabling SELinux..."
|
|
|
|
sed -e s/^SELINUX=.*$/SELINUX=disabled/ </etc/selinux/config >/etc/selinux/config.processed
|
|
|
|
mv /etc/selinux/config.processed /etc/selinux/config
|
|
|
|
setenforce 0 2>/dev/null
|
|
|
|
|
|
|
|
#echo "--> Turning off unnecessary services..."
|
|
|
|
# FIXME: perhaps there is more elegant way to do this?
|
|
|
|
for f in /etc/init.d/*
|
|
|
|
do
|
|
|
|
srv=`basename $f`
|
|
|
|
[ $srv = 'functions' ] && continue
|
|
|
|
[ $srv = 'killall' ] && continue
|
|
|
|
[ $srv = 'halt' ] && continue
|
|
|
|
[ $srv = 'single' ] && continue
|
2011-03-16 08:41:41 +01:00
|
|
|
[ $srv = 'reboot' ] && continue
|
2011-03-11 01:42:42 +01:00
|
|
|
[ $srv = 'qubes_gui' ] && continue
|
|
|
|
chkconfig $srv off
|
|
|
|
done
|
|
|
|
|
|
|
|
#echo "--> Enabling essential services..."
|
|
|
|
chkconfig rsyslog on
|
|
|
|
chkconfig haldaemon on
|
|
|
|
chkconfig messagebus on
|
|
|
|
chkconfig iptables on
|
|
|
|
chkconfig --add qubes_core || echo "WARNING: Cannot add service qubes_core!"
|
|
|
|
chkconfig qubes_core on || echo "WARNING: Cannot enable service qubes_core!"
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: make this not display the silly message about security context...
|
|
|
|
sed -i s/^id:.:initdefault:/id:3:initdefault:/ /etc/inittab
|
|
|
|
|
|
|
|
# Remove most of the udev scripts to speed up the VM boot time
|
|
|
|
# Just leave the xen* scripts, that are needed if this VM was
|
|
|
|
# ever used as a net backend (e.g. as a VPN domain in the future)
|
|
|
|
#echo "--> Removing unnecessary udev scripts..."
|
|
|
|
mkdir -p /var/lib/qubes/removed-udev-scripts
|
|
|
|
for f in /etc/udev/rules.d/*
|
|
|
|
do
|
|
|
|
if [ $(basename $f) == "xen-backend.rules" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $(basename $f) == "xend.rules" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2011-07-09 11:46:34 +02:00
|
|
|
if [ $(basename $f) == "99-qubes_network.rules" ] ; then
|
2011-03-11 01:42:42 +01:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $(basename $f) == "90-hal.rules" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
mv $f /var/lib/qubes/removed-udev-scripts/
|
|
|
|
done
|
|
|
|
mkdir -p /rw
|
|
|
|
#rm -f /etc/mtab
|
|
|
|
#echo "--> Removing HWADDR setting from /etc/sysconfig/network-scripts/ifcfg-eth0"
|
|
|
|
#mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.orig
|
|
|
|
#grep -v HWADDR /etc/sysconfig/network-scripts/ifcfg-eth0.orig > /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
|
|
|
|
|
|
%preun
|
|
|
|
if [ "$1" = 0 ] ; then
|
|
|
|
# no more packages left
|
|
|
|
chkconfig qubes_core off
|
|
|
|
mv /var/lib/qubes/fstab.orig /etc/fstab
|
|
|
|
mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
|
|
|
|
mv /var/lib/qubes/serial.orig /etc/init/serial.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root,-)
|
|
|
|
/etc/fstab
|
|
|
|
/etc/init.d/qubes_core
|
|
|
|
/etc/sysconfig/iptables
|
|
|
|
/var/lib/qubes
|
2011-04-06 13:59:43 +02:00
|
|
|
/etc/yum.repos.d/qubes%{dist}.repo
|
2011-04-04 11:22:32 +02:00
|
|
|
/etc/pki/rpm-gpg/RPM-GPG-KEY-qubes*
|
2011-03-11 01:42:42 +01:00
|
|
|
/sbin/qubes_serial_login
|
2011-06-06 02:37:55 +02:00
|
|
|
/usr/bin/xenstore-watch-qubes
|
2011-07-09 11:46:34 +02:00
|
|
|
/etc/udev/rules.d/99-qubes_network.rules
|
2011-07-02 19:11:15 +02:00
|
|
|
/etc/sysconfig/modules/qubes_core.modules
|
2011-04-23 02:31:54 +02:00
|
|
|
/usr/lib/qubes/setup_ip
|
2011-06-12 00:50:39 +02:00
|
|
|
/etc/yum/post-actions/qubes_trigger_sync_appmenus.action
|
|
|
|
/usr/lib/qubes/qubes_trigger_sync_appmenus.sh
|
2011-06-22 00:44:48 +02:00
|
|
|
/usr/lib/qubes/qubes_download_dom0_updates.sh
|
2011-06-30 01:07:47 +02:00
|
|
|
/lib/firmware/updates
|