mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-02-06 09:26:35 +00:00
148 lines
2.3 KiB
Bash
Executable File
148 lines
2.3 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
INDEX_DIR="/var/lib/scratchpkg/index"
|
|
|
|
PKG=(
|
|
linux-api-headers
|
|
man-pages
|
|
glibc
|
|
tzdata
|
|
zlib
|
|
file
|
|
readline
|
|
m4
|
|
bc
|
|
binutils
|
|
gmp
|
|
mpfr
|
|
libmpc
|
|
gcc
|
|
bzip2
|
|
pkg-config
|
|
ncurses
|
|
attr
|
|
acl
|
|
libcap
|
|
sed
|
|
shadow
|
|
psmisc
|
|
iana-etc
|
|
bison
|
|
flex
|
|
grep
|
|
bash
|
|
libtool
|
|
gdbm
|
|
gperf
|
|
expat
|
|
inetutils
|
|
perl
|
|
perl-xml-parser
|
|
intltool
|
|
autoconf
|
|
automake
|
|
xz
|
|
kmod
|
|
gettext
|
|
elfutils
|
|
procps-ng
|
|
e2fsprogs
|
|
coreutils
|
|
diffutils
|
|
gawk
|
|
findutils
|
|
groff
|
|
grub
|
|
less
|
|
gzip
|
|
iproute2
|
|
kbd
|
|
libpipeline
|
|
make
|
|
patch
|
|
sysklogd
|
|
sysvinit
|
|
eudev
|
|
util-linux
|
|
man-db
|
|
tar
|
|
texinfo
|
|
vim
|
|
filesystem
|
|
base-meta
|
|
openssl
|
|
ca-certificates-utils
|
|
ca-certificates
|
|
wget
|
|
curl
|
|
httpup
|
|
scratchpkg
|
|
)
|
|
|
|
for i in ${PKG[@]}; do
|
|
if [[ -d "/var/lib/scratchpkg/index/$i" ]]; then
|
|
echo "$i is installed"
|
|
else
|
|
echo
|
|
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
|
|
;;
|
|
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|scratchpkg)
|
|
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/$i ]; then
|
|
echo "Failed installing $list."
|
|
echo "ENTER to skip and continue, CTRL + C to abort."
|
|
read
|
|
fi
|
|
fi
|
|
done
|
|
|
|
exit 0
|