Browse code

Fix bash %install section.

YustasSwamp authored on 2015/07/01 07:06:29
Showing 1 changed files
... ...
@@ -36,10 +36,11 @@ make %{?_smp_mflags}
36 36
 make DESTDIR=%{buildroot} install
37 37
 ln -s bash %{buildroot}/bin/sh
38 38
 install -vdm 755 %{buildroot}/etc
39
+install -vdm 755 %{buildroot}/etc/profile.d
40
+install -vdm 755 %{buildroot}/etc/skel
39 41
 
40 42
 # Create dircolors
41
-install -vdm 755 %{buildroot}/etc/profile.d
42
-cat > /etc/profile.d/dircolors.sh << "EOF"
43
+cat > %{buildroot}/etc/profile.d/dircolors.sh << "EOF"
43 44
 # Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc.
44 45
 if [ -f "/etc/dircolors" ] ; then
45 46
         eval $(dircolors -b /etc/dircolors)
... ...
@@ -52,7 +53,7 @@ alias ls='ls --color=auto'
52 52
 alias grep='grep --color=auto'
53 53
 EOF
54 54
 
55
-cat > /etc/profile.d/extrapaths.sh << "EOF"
55
+cat > %{buildroot}/etc/profile.d/extrapaths.sh << "EOF"
56 56
 if [ -d /usr/local/lib/pkgconfig ] ; then
57 57
         pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
58 58
 fi
... ...
@@ -64,7 +65,7 @@ if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then
64 64
 fi
65 65
 EOF
66 66
 
67
-cat > /etc/profile.d/readline.sh << "EOF"
67
+cat > %{buildroot}/etc/profile.d/readline.sh << "EOF"
68 68
 # Setup the INPUTRC environment variable.
69 69
 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
70 70
         INPUTRC=/etc/inputrc
... ...
@@ -72,7 +73,7 @@ fi
72 72
 export INPUTRC
73 73
 EOF
74 74
 
75
-cat > /etc/profile.d/umask.sh << "EOF"
75
+cat > %{buildroot}/etc/profile.d/umask.sh << "EOF"
76 76
 # By default, the umask should be set.
77 77
 if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then
78 78
   umask 002
... ...
@@ -81,7 +82,7 @@ else
81 81
 fi
82 82
 EOF
83 83
 
84
-cat > /etc/profile.d/i18n.sh << "EOF"
84
+cat > %{buildroot}/etc/profile.d/i18n.sh << "EOF"
85 85
 # Begin /etc/profile.d/i18n.sh
86 86
 
87 87
 unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES \
... ...
@@ -110,7 +111,7 @@ export LANG="${LANG:-C}"
110 110
 # End /etc/profile.d/i18n.sh
111 111
 EOF
112 112
 
113
-cat > /etc/bashrc << "EOF"
113
+cat > %{buildroot}/etc/bashrc << "EOF"
114 114
 # Begin /etc/bashrc
115 115
 # Written for Beyond Linux From Scratch
116 116
 # by James Robertson <jameswrobertson@earthlink.net>
... ...
@@ -148,7 +149,8 @@ unset RED GREEN NORMAL
148 148
 # End /etc/bashrc
149 149
 EOF
150 150
 
151
-cat > ~/.bash_profile << "EOF"
151
+
152
+cat > %{buildroot}/etc/skel/.bash_profile << "EOF"
152 153
 # Begin ~/.bash_profile
153 154
 # Written for Beyond Linux From Scratch
154 155
 # by James Robertson <jameswrobertson@earthlink.net>
... ...
@@ -176,7 +178,7 @@ fi
176 176
 # End ~/.bash_profile
177 177
 EOF
178 178
 
179
-cat > ~/.bashrc << "EOF"
179
+cat > %{buildroot}/etc/skel/.bashrc << "EOF"
180 180
 # Begin ~/.bashrc
181 181
 # Written for Beyond Linux From Scratch
182 182
 # by James Robertson <jameswrobertson@earthlink.net>
... ...
@@ -195,7 +197,7 @@ fi
195 195
 # End ~/.bashrc
196 196
 EOF
197 197
 
198
-cat > ~/.bash_logout << "EOF"
198
+cat > %{buildroot}/etc/skel/.bash_logout << "EOF"
199 199
 # Begin ~/.bash_logout
200 200
 # Written for Beyond Linux From Scratch
201 201
 # by James Robertson <jameswrobertson@earthlink.net>
... ...
@@ -205,14 +207,20 @@ cat > ~/.bash_logout << "EOF"
205 205
 # End ~/.bash_logout
206 206
 EOF
207 207
 
208
-dircolors -p > /etc/dircolors
209
-
208
+dircolors -p > %{buildroot}/etc/dircolors
210 209
 
211 210
 %find_lang %{name}
212 211
 rm -rf %{buildroot}/%{_infodir}
212
+
213
+%post
214
+test -e /root/.bash_profile || cp /etc/skel/.bash_profile /root
215
+test -e /root/.bashrc || cp /etc/skel/.bashrc /root
216
+test -e /root/.bash_logout || cp /etc/skel/.bash_logout /root
217
+
213 218
 %files
214 219
 %defattr(-,root,root)
215 220
 /bin/*
221
+%{_sysconfdir}
216 222
 %{_defaultdocdir}/%{name}-%{version}/*
217 223
 %{_defaultdocdir}/%{name}/*
218 224
 %{_mandir}/*/*
... ...
@@ -222,7 +230,7 @@ rm -rf %{buildroot}/%{_infodir}
222 222
 
223 223
 %changelog
224 224
 *	Tue Jun 30 2015 Alexey Makhalov <amakhalov@vmware.com> 4.3-2
225
--	/etc/profile.d permission fix
225
+-	/etc/profile.d permission fix. Pack /etc files into rpm
226 226
 *	Wed Oct 22 2014 Divya Thaluru <dthaluru@vmware.com> 4.3-1
227 227
 -	Initial version
228 228