Upload var/lib/dpkg/info/dash.postinst with huggingface_hub
Browse files- var/lib/dpkg/info/dash.postinst +149 -0
var/lib/dpkg/info/dash.postinst
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/dash
|
2 |
+
set -e
|
3 |
+
|
4 |
+
# $1: dfile, $2: link target, $3: distrib
|
5 |
+
replace_with_link() {
|
6 |
+
dfile=$1; ltarget=$2; distrib=$3
|
7 |
+
temp=$dfile.tmp
|
8 |
+
# Safely create a symlink to $ltarget at $dfile, first
|
9 |
+
# making a backup of $dfile (the file being diverted)
|
10 |
+
# in $distrib (if specified).
|
11 |
+
#
|
12 |
+
# The cp / ln -s / mv dance avoids having to live without
|
13 |
+
# $dfile (think: /bin/sh) for even a moment, so applications
|
14 |
+
# running in parallel can continue without trouble.
|
15 |
+
# See dash.preinst for details.
|
16 |
+
if [ -n "$distrib" ] && [ -e "$dfile" ]; then
|
17 |
+
cp -dp "$dfile" "$distrib"
|
18 |
+
fi
|
19 |
+
ln -sf "$ltarget" "$temp"
|
20 |
+
mv -f "$temp" "$dfile"
|
21 |
+
}
|
22 |
+
|
23 |
+
claim_binsh() {
|
24 |
+
dfile=$1 ltarget=$2 distrib=${3:-$dfile.distrib}
|
25 |
+
diverter=$(dpkg-divert --listpackage $dfile)
|
26 |
+
truename=$(dpkg-divert --truename $dfile)
|
27 |
+
|
28 |
+
if [ "$diverter" = dash ]; then
|
29 |
+
# good.
|
30 |
+
return
|
31 |
+
fi
|
32 |
+
|
33 |
+
if [ "$diverter" = LOCAL ]; then
|
34 |
+
# The sysadmin wants it this way. Who am I to argue?
|
35 |
+
return
|
36 |
+
fi
|
37 |
+
|
38 |
+
if [ -n "$diverter" ] && [ "$diverter" != bash ]; then
|
39 |
+
# Let dpkg-divert error out; we are not taking
|
40 |
+
# over the diversion, unless we added it
|
41 |
+
# ourselves on behalf of bash.
|
42 |
+
dpkg-divert --package dash --no-rename --remove $dfile
|
43 |
+
echo "This should never be reached"
|
44 |
+
exit 1
|
45 |
+
fi
|
46 |
+
|
47 |
+
dpkg-divert --package bash --no-rename --remove $dfile
|
48 |
+
dpkg-divert --package dash --no-rename --divert $distrib --add $dfile
|
49 |
+
# remove the old equivalent of $distrib, if it existed.
|
50 |
+
if [ -n "$truename" ]; then
|
51 |
+
rm -f "$truename"
|
52 |
+
fi
|
53 |
+
replace_with_link $dfile $ltarget $distrib
|
54 |
+
}
|
55 |
+
|
56 |
+
unclaim_binsh() {
|
57 |
+
dfile=$1 ltarget=$2 distrib=${3:-$dfile.distrib}
|
58 |
+
diverter=$(dpkg-divert --listpackage $dfile)
|
59 |
+
truename=$(dpkg-divert --truename $dfile)
|
60 |
+
|
61 |
+
if [ "$diverter" != dash ]; then
|
62 |
+
# good.
|
63 |
+
return
|
64 |
+
fi
|
65 |
+
|
66 |
+
# Donate the diversion and sh symlink to the bash package.
|
67 |
+
ltarget=$(echo $ltarget | sed s/dash/bash/)
|
68 |
+
dpkg-divert --package dash --no-rename --remove $dfile
|
69 |
+
dpkg-divert --package bash --no-rename --divert $distrib --add $dfile
|
70 |
+
if [ -n "$truename" ]; then
|
71 |
+
rm -f "$truename"
|
72 |
+
fi
|
73 |
+
replace_with_link $dfile $ltarget $distrib
|
74 |
+
}
|
75 |
+
|
76 |
+
initial_binsh_setup() {
|
77 |
+
dfile=$1 ltarget=$2 distrib=${3:-$dfile.distrib} ashfile=$4
|
78 |
+
diverter=$(dpkg-divert --listpackage $dfile)
|
79 |
+
truename=$(dpkg-divert --truename $dfile)
|
80 |
+
|
81 |
+
if [ -z "$diverter" ]; then
|
82 |
+
# good.
|
83 |
+
return
|
84 |
+
fi
|
85 |
+
|
86 |
+
if [ "$diverter" = ash ]; then
|
87 |
+
dpkg-divert --package ash --no-rename --remove $dfile
|
88 |
+
dpkg-divert --package dash --no-rename --divert $distrib --add $dfile
|
89 |
+
|
90 |
+
if [ "$truename" != "$distrib" ] && [ -e "$truename" ]; then
|
91 |
+
mv "$truename" "$distrib"
|
92 |
+
fi
|
93 |
+
replace_with_link $dfile $ltarget
|
94 |
+
return
|
95 |
+
fi
|
96 |
+
|
97 |
+
if
|
98 |
+
[ -h $dfile ] &&
|
99 |
+
[ -f $dfile ] &&
|
100 |
+
[ -f $ashfile ] &&
|
101 |
+
cmp $dfile $ashfile
|
102 |
+
then
|
103 |
+
replace_with_link $dfile $ltarget
|
104 |
+
fi
|
105 |
+
}
|
106 |
+
|
107 |
+
add_shell() {
|
108 |
+
if ! type add-shell > /dev/null 2>&1; then
|
109 |
+
return
|
110 |
+
fi
|
111 |
+
|
112 |
+
add-shell /bin/dash
|
113 |
+
}
|
114 |
+
|
115 |
+
debconf=
|
116 |
+
if [ -f /usr/share/debconf/confmodule ]; then
|
117 |
+
. /usr/share/debconf/confmodule
|
118 |
+
debconf=yes
|
119 |
+
fi
|
120 |
+
|
121 |
+
if [ "$1" = configure ] && [ -z "$2" ]; then
|
122 |
+
initial_binsh_setup /bin/sh dash '' /bin/ash
|
123 |
+
initial_binsh_setup /usr/share/man/man1/sh.1.gz dash.1.gz \
|
124 |
+
/usr/share/man/man1/sh.distrib.1.gz \
|
125 |
+
/usr/share/man/man1/ash.1.gz
|
126 |
+
add_shell
|
127 |
+
elif [ "$1" = configure ] && dpkg --compare-versions "$2" lt 0.4.18; then
|
128 |
+
add_shell
|
129 |
+
fi
|
130 |
+
|
131 |
+
if [ $debconf ]; then
|
132 |
+
db_get dash/sh
|
133 |
+
if [ "$RET" = true ]; then
|
134 |
+
claim_binsh /bin/sh dash
|
135 |
+
claim_binsh /usr/share/man/man1/sh.1.gz dash.1.gz \
|
136 |
+
/usr/share/man/man1/sh.distrib.1.gz
|
137 |
+
else
|
138 |
+
unclaim_binsh /bin/sh dash
|
139 |
+
unclaim_binsh /usr/share/man/man1/sh.1.gz dash.1.gz \
|
140 |
+
/usr/share/man/man1/sh.distrib.1.gz
|
141 |
+
fi
|
142 |
+
fi
|
143 |
+
|
144 |
+
# Automatically added by dh_installmenu/12.1.1ubuntu1
|
145 |
+
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
|
146 |
+
update-menus
|
147 |
+
fi
|
148 |
+
# End automatically added section
|
149 |
+
|