This commit is contained in:
emmett1
2018-02-26 15:31:50 +08:00
parent 67c6e26ae5
commit 9c50e3455e

View File

@@ -2,10 +2,7 @@
INDEX_DIR="/var/lib/scratchpkg/index"
source "/usr/share/scratchpkg/color"
source "/usr/share/scratchpkg/message"
basepkg=(linux-api-headers
PKG=(linux-api-headers
man-pages
glibc
tzdata
@@ -46,6 +43,7 @@ automake
xz
kmod
gettext
elfutils
procps-ng
e2fsprogs
coreutils
@@ -73,23 +71,66 @@ filesystem
rc-init
base-meta)
for list in ${basepkg[@]}; do
if [ -d $INDEX_DIR/$list ]; then
msg "$list is installed"
for i in ${PKG[@]}; do
if [[ -d "/var/lib/scratchpkg/index/$i" ]]; then
echo "$i is installed"
else
echo
msg "Installing $list..."
case $list in
gcc | bash | perl | coreutils | filesystem )
scratch -p $list -i -id -ic
echo "Installing $i..."
case $i in
glibc)
ln -sfv /tools/lib/gcc /usr/lib
ln -sfv /tools/bin/m4 /usr/bin
scratch -i -id -p $i
echo "Adjusting toolchain"
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/bin/ld
gcc -dumpspecs | sed -e 's@/tools@@g' \
-e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
-e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
`dirname $(gcc --print-libgcc-file-name)`/specs
echo 'int main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
grep -B1 '^ /usr/include' dummy.log
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
grep "/lib.*/libc.so.6 " dummy.log
grep found dummy.log
rm -v dummy.c a.out dummy.log
sleep 5
rm /usr/lib/gcc
rm /usr/bin/m4
;;
* )
scratch -p $list -i -id
bc)
ln -sv /tools/lib/libncursesw.so.6 /usr/lib/libncursesw.so.6
ln -sfv libncurses.so.6 /usr/lib/libncurses.so
scratch -i -id -p $i
rm /usr/lib/{libncurses.so,libncursesw.so.6}
;;
gcc|coreutils|bash|filesystem)
scratch -i -id -ic -p $i
;;
perl)
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
scratch -i -id -ic -p $i
rm /etc/hosts
;;
base-meta)
scratch -i -p $i
;;
*)
scratch -i -id -p $i
;;
esac
if [ ! -d $INDEX_DIR/$list ]; then
msgerr "Failed installing $list."
msgerr "Press ENTER to skip and continue, press CTRL + C to cancel."
if [ ! -d $INDEX_DIR/$i ]; then
echo "Failed installing $list."
echo "ENTER to skip and continue, CTRL + C to abort."
read
fi
fi