-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddpkg
More file actions
executable file
·189 lines (164 loc) · 6.4 KB
/
addpkg
File metadata and controls
executable file
·189 lines (164 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/sh
AddPackages()
{
PKGDIR="/usr/share/siduction-scripts/packages"
PKGSRC_LOCAL="/usr/share/siduction-scripts/clone"
PKGSRC_REMOTE="https://github.com/siduction/pyfll.git"
if [ -e /etc/default/distro ]; then
. /etc/default/distro
fi
settings_version=$(echo $FLL_WALLPAPER | cut -d / -f 5)
xorg_installed=$(dpkg -l | grep Xorg)
if [ -z "${xorg_installed}" ]; then
dest_platform=nox
else
dest_platform=xorg
fi
case $1 in
cinnamon)
PACK_PROFILE=cinnamon
;;
gnome)
PACK_PROFILE=gnome
;;
kde)
PACK_PROFILE=kde
;;
plasma5)
PACK_PROFILE=plasma5
;;
lxde)
PACK_PROFILE=lxde
;;
lxqt)
PACK_PROFILE=lxqt
;;
mate)
PACK_PROFILE=mate
;;
siducation-full)
PACK_PROFILE=siducation-full
;;
siducation-lite)
PACK_PROFILE=siducation-lite
;;
xfce)
PACK_PROFILE=xfce
;;
custom)
PACK_PROFILE=custom
;;
*)
;;
esac
if [ "$PACK_PROFILE" = "custom" ]; then
if [ ! -f ${PKGDIR}/custom ] ; then
echo '######################################################'
echo 'WARNING custom pkglist file not found!'
echo 'Please add file /usr/share/siduction-scripts/custom.'
echo 'Please use as template /usr/share/siduction-scripts/custom.ex file.'
echo "WARNING don't add inexistent packages names to don't get in trouble."
echo 'Thank you !'
echo '######################################################'
exit 1
else
# moves custom pkg list to custom-pklist.orig and show a message about it
echo '######################################################'
echo "Cpying custom pkglist to custom.orig"
echo "If you don't need it anymore you should remove it."
echo '######################################################'
awk '/^packages/,/^"""/' ${PKGDIR}/${PACK_PROFILE} | grep -v '"""' | grep -v '#' > ${PKGDIR}/${PACK_PROFILE}-pkglist
cp ${PKGDIR}/$PACK_PROFILE ${PKGDIR}/${PACK_PROFILE}.orig
fi
else
# TODO settings
#case ${settings_version} in
# december)
# echo " siduction-settings-${PACK_PROFILE}-${settings_version}" > ${PKGDIR}/${PACK_PROFILE}-pkglist
# echo " siduction-art-${PACK_PROFILE}-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
# ;;
# indiansummer)
# echo " siduction-settings-${PACK_PROFILE}-${settings_version}" > ${PKGDIR}/${PACK_PROFILE}-pkglist
# echo " siduction-art-${PACK_PROFILE}-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
# echo " siduction-art-wallpaper-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
# ;;
# paintitblack)
# echo " siduction-settings-${PACK_PROFILE}-paintitblack" > ${PKGDIR}/${PACK_PROFILE}-pkglist
# echo " siduction-art-${PACK_PROFILE}-paintitblack" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
# echo " siduction-art-wallpaper-paintitblack" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
# ;;
# *)
# echo " There aren't supported settings for ${PACK_PROFILE} until now"
# ;;
#esac
# clone pyfll git and get requested PACK_PROFILE or show a message for custom pkg list
echo "\nCloning pyfll."
git clone "${PKGSRC_REMOTE}" "${PKGSRC_LOCAL}"
sleep 2
echo "\nFetching siduction ${PACK_PROFILE} profile list."
cp "${PKGSRC_LOCAL}/pyfll/packages/${PACK_PROFILE}" "${PKGDIR}/${PACK_PROFILE}"
# Reads packages from packages profile
awk '/^packages/,/^"""/' ${PKGDIR}/${PACK_PROFILE} | grep -v '"""' | grep -v '#' >> ${PKGDIR}/${PACK_PROFILE}-pkglist
# Search main file package for include dependecies
# and build an depends file ( depends )
awk '/^deps/,/^"""/' ${PKGDIR}/${PACK_PROFILE} | grep -v '"""' | grep -v '#' > ${PKGDIR}/${PACK_PROFILE}-deps
# Search if we have NOX or XORG
case ${dest_platform} in
xorg)
cat ${PKGDIR}/${PACK_PROFILE}-deps | grep -v 200 | grep -v 100 | grep -v 300 |grep -v 500 > ${PKGDIR}/${PACK_PROFILE}-depends
;;
nox)
cat ${PKGDIR}/${PACK_PROFILE}-deps | grep -v 200 | grep -v 100 | grep -v 300 | grep -v live | grep -v fll | grep -v installer > ${PKGDIR}/${PACK_PROFILE}-depends
echo " siduction-settings-lightdm-gtk-${settings_version}" >> ${PKGDIR}/${PACK_PROFILE}-pkglist
;;
*)
echo "You can use addpkg only over on installed NOX or XORG siduction."
;;
esac
while read pkgdepends ; do
echo "Fetching for ${PACK_PROFILE} profile $pkgdepends depend."
cp "${PKGSRC_LOCAL}/pyfll/packages/packages.d/$pkgdepends" "${PKGDIR}/$pkgdepends-depfiles"
done < ${PKGDIR}/${PACK_PROFILE}-depends
for i in ${PKGDIR}/*-depfiles; do
awk '/^packages/,/^"""/' ${i} | grep -v '"""' | grep -v '#' >> ${PKGDIR}/${PACK_PROFILE}-pkglist
done
# Removes temporary files
if [ -f ${PKGDIR}/${PACK_PROFILE}-pkglist ] ; then
rm -f ${PKGDIR}/*-dep*
rm -f ${PKGDIR}/${PACK_PROFILE}
fi
fi
# install files
apt-get install $(cat ${PKGDIR}/${PACK_PROFILE}-pkglist)
# purge meta files
# originally a hard-coded list: siduction-meta-xorg siduction-meta-xsiduction siduction-meta-xdebian siduction-meta-mediabase
purgelist="$(dpkg -l | awk '/siduction-meta/ {print $2}')"
if [ -z "${purgelist}" ] ; then
printf "%s\n" "Nothing to purge!"
else
printf "%s\n" "Now purging meta packages: ${purgelist}"
apt-get purge --assume-yes "${purgelist}"
fi
# removes built package list and pyfll git clone
rm -f /usr/share/siduction-scripts/packages/${PACK_PROFILE}-pkglist
rm -Rf "${PKGSRC_LOCAL}"
# Settings message
if [ "$PACK_PROFILE" = "custom" ]; then
echo "You should customize your's new added flavour."
else
echo "\nYour installed settings for existing flavours are ${settings_version}."
echo "Please add your desired settings for ${PACK_PROFILE} if exists in siduction repos. \n"
echo "Otherwise you can try siduction-settings-${PACK_PROFILE}-paintitblack
siduction-art-${PACK_PROFILE}-paintitblack and siduction-art-wallpaper-paintitblack. \n"
sleep 2
fi
}
case "$1" in
cinnamon|custom|gnome|kde|plasma5|lxde|lxqt|mate|siducation-full|siducation-lite|xfce)
AddPackages $1
;;
*)
echo "Usage: addpkg {cinnamon|custom|gnome|kde|plasma5|lxde|lxqt|mate|rqt|siducation-full|siducation-lite|xfce}"
exit 1
;;
esac