Bug#797377: freedombox-setup: Don't mess with core system files

2015-09-01 Thread James Valleroy
On Sun, 30 Aug 2015 13:08:30 +0530 Sunil Mohan Adapa 
wrote:
> Currently, freedombox-setup overwrite many of the core system files eventhough
> it does need to.  These files are
> 
> /etc/fstab
> /etc/hosts
> /etc/apt/sources.list
> 
> All of these changes are currently unnecessary.  The proposed patchset removes
> code that does this and also provides a rationale.

I've committed this patch.



signature.asc
Description: OpenPGP digital signature


Bug#797377: freedombox-setup: Don't mess with core system files

2015-08-30 Thread Sunil Mohan Adapa
Package: freedombox-setup
Version: 0.5
Severity: normal
Tags: patch

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Currently, freedombox-setup overwrite many of the core system files eventhough
it does need to.  These files are

/etc/fstab
/etc/hosts
/etc/apt/sources.list

All of these changes are currently unnecessary.  The proposed patchset removes
code that does this and also provides a rationale.

I have performed the following tests on a full build image with patches
applied:

- - Tmpfs should be mounted.

- - cgroupsfs should be mounted.

- - /etc/hosts should be exactly like before the patch.

- - Cdrom sources should not be present in images.

I found that the hosts is missing two entries:
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix

That is actually the right thing to do according to:
https://bugs.debian.org/688090

- -- 
Sunil

-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBAgAGBQJV4rLyAAoJEDbDYUQMm8lxfDwQAJUDmeNlnpGwqA1Myo0pEK5Y
jH3o6406H4104/X2Sj2jkYIJNOfnbXYH2jg17fitgPuvsqavWPldbqTP+WCN1fxE
fN1ugL/htVxCoHGhuylvgn5uoEOwcpIbhyVtw2nprbjaxEc0VbuucWdL319oeeg1
lUsMUI/C3dljGzqVLkCI/DQxYlVjJfUgYmStfR6V4pXXcwulKukZ5fS4ns1X073i
fVghSlmr6+UVTpsMob+DzzO/w1B9uK20fbxJo6F81LMXkzv+n7vkssIO6zr+X52O
tf2X21knoxnJRWPZSa7TZ1LEqiNNkVc67/+0w1qf/MCvfhl7SVYmfqVlnlTyhiMI
q638JLxw8V5M6C//Z1bnolN1A78tIg6Pm62s0FjuwR2BFfdfoeV8ajDjTM5YH8Kh
WgbWi9MZmQTvgPoaUow2pXO/Wv4shOP2Z/QROhjj+TYNmilY+TQsyWkY1ZMsMbz2
wFxArDvCDCPg+h71Gs0N7YtE+7Iu805VNHk7Ha6ouYdbOJLaW7x8KkbmfsVn5RND
3mzhAPakvPBD2AgRtJgs3FIQRZz0DETRrgDbz/6MPtS+4qb0mjLQhPNtwqis5Qpy
44feQTK+Ja9uvG0RdnlChr4BXnLMeYRjKNAsPkirf+Dd2QlJXr6i3LePl9WEP9NM
i8BkzoCwPDKJ70d6x3/2
=Ilp/
-END PGP SIGNATURE-
From 921c01fc413ff0368d3847d00983486f13fc6fd2 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa su...@medhas.org
Date: Fri, 28 Aug 2015 09:39:37 +0530
Subject: [PATCH 1/4] Don't add tmpfs to fstab

Systemd automatically mounts tmpfs on /tmp even when /etc/fstab does not
contain the entry.

By removing this line we are messing up the system a bit less for people
installing the freedombox-setup on their Debian machines.
---
 setup.d/10_hardware | 13 -
 1 file changed, 13 deletions(-)

diff --git a/setup.d/10_hardware b/setup.d/10_hardware
index ab52ff9..2d674e1 100755
--- a/setup.d/10_hardware
+++ b/setup.d/10_hardware
@@ -220,19 +220,6 @@ EOF
 echo rtc_sunxi  /etc/initramfs-tools/modules
 }
 
-tmp_on_tmpfs() {
-if grep -q /tmp /etc/fstab ; then
-	:
-else
-	echo info: adding /tmp/ as tmpfs to /etc/fstab
-	cat  /etc/fstab EOF
-tmpfs /tmp  tmpfs   rw,nosuid,nodev 0   0
-EOF
-fi
-}
-
-tmp_on_tmpfs
-
 case $MACHINE in
 dreamplug|guruplug)
 	dreamplug_flash
-- 
2.5.0


From 71258b118c95d64395a3a22d87c923f0a4c7d764 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa su...@medhas.org
Date: Fri, 28 Aug 2015 09:43:08 +0530
Subject: [PATCH 2/4] Don't add cgroupfs to /etc/fstab

Systemd automatically mounts cgroupfs on /sys/fs/cgroup even when
/etc/fstab does not contain the entry.

By removing this line we are messing up the system a bit less for people
installing the freedombox-setup on their Debian machines.
---
 setup.d/20_lxc | 5 -
 1 file changed, 5 deletions(-)

diff --git a/setup.d/20_lxc b/setup.d/20_lxc
index 99cf06f..940435c 100755
--- a/setup.d/20_lxc
+++ b/setup.d/20_lxc
@@ -21,10 +21,5 @@ create_lxc_box() {
 
 DEBIAN_FRONTEND=noninteractive apt-get install -y lxc bridge-utils
 
-if ! grep cgroup /etc/fstab ; then
-echo 'cgroup /sys/fs/cgroup cgroup defaults 0 0'  /etc/fstab
-mount /sys/fs/cgroup
-fi
-
 # The Internet router / firewall container
 #create_lxc_box internet
-- 
2.5.0


From e2ba5f77c2daf85f2133ca2b70aba372f941e6e6 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa su...@medhas.org
Date: Fri, 28 Aug 2015 09:45:30 +0530
Subject: [PATCH 3/4] Don't write /etc/hosts

The hosts file setup by Debian by default on a debootstrap image is
sufficient.

By removing this we are messing up the system a bit less for people
installing the freedombox-setup on their Debian machines.
---
 setup.d/10_hardware | 14 --
 1 file changed, 14 deletions(-)

diff --git a/setup.d/10_hardware b/setup.d/10_hardware
index 2d674e1..da99469 100755
--- a/setup.d/10_hardware
+++ b/setup.d/10_hardware
@@ -243,17 +243,3 @@ esac
 
 echo info: prevent macchanger from running automatically
 sed -i 's/ENABLE_ON_POST_DOWN=yes/ENABLE_ON_POST_DOWN=no/' /etc/default/macchanger
-
-echo info: rewriting /etc/hosts, leave host specific info to libnss-myhostname.
-cat  /etc/hosts EOF
-# Only generic entries in /etc/hosts, host specific information is
-# provided by libnss-myhostname.
-127.0.0.1   localhost
-
-# The following lines are desirable for IPv6 capable hosts
-::1 localhost ip6-localhost ip6-loopback
-fe00::0 ip6-localnet
-ff00::0 ip6-mcastprefix
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-EOF
-- 
2.5.0


From c4241bb8dbd25fdd41bd4fba03222875f86820de Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa