Skip to content

Instantly share code, notes, and snippets.

@nickwph
Last active December 12, 2021 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickwph/6a915209455e2394face6e38f29312e4 to your computer and use it in GitHub Desktop.
Save nickwph/6a915209455e2394face6e38f29312e4 to your computer and use it in GitHub Desktop.
#!/bin/sh
#TYPE='generic'
TYPE='alternative'
#|---------|-----------------------|---------------|---------------|---------------------|-------------------|-------------------|----------------------|-------------------|
#| ARCH | aarch64-k3.10 | armv5sf-k3.2 | armv7sf-k2.6 | armv7sf-k3.2 | mipselsf-k3.4 | mipssf-k3.4 | x64-k3.2 | x86-k2.6 |
#| LOADER | ld-linux-aarch64.so.1 | ld-linux.so.3 | ld-linux.so.3 | ld-linux.so.3 | ld.so.1 | ld.so.1 | ld-linux-x86-64.so.2 | ld-linux.so.2 |
#| GLIBC | 2.27 | 2.27 | 2.23 | 2.27 | 2.27 | 2.27 | 2.27 | 2.23 |
#|---------|-----------------------|---------------|---------------|---------------------|-------------------|-------------------|----------------------|-------------------|
unset LD_LIBRARY_PATH
unset LD_PRELOAD
ARCH=armv7sf-k3.2
LOADER=ld-linux.so.3
GLIBC=2.27
echo 'Info: Checking for prerequisites and creating folders...'
if [ -d /data/entware ]; then
echo 'Warning: Folder /data/entware exists!'
else
mkdir /data/entware
fi
# no need to create many folders. entware-opt package creates most
for folder in bin etc lib/opkg tmp var/lock
do
if [ -d "/data/entware/$folder" ]; then
echo "Warning: Folder /data/entware/$folder exists!"
echo 'Warning: If something goes wrong please clean /data/entware folder and try again.'
else
mkdir -p /data/entware/$folder
fi
done
echo 'Info: Opkg package manager deployment...'
URL=http://bin.entware.net/${ARCH}/installer
curl -o /data/entware/bin/opkg $URL/opkg
chmod 755 /data/entware/bin/opkg
curl -o /data/entware/etc/opkg.conf $URL/opkg.conf
echo 'Info: Basic packages installation...'
/data/entware/bin/opkg update
if [ $TYPE = 'alternative' ]; then
/data/entware/bin/opkg install busybox
fi
/data/entware/bin/opkg install entware-opt
# Fix for multiuser environment
chmod 777 /data/entware/tmp
for file in passwd group shells shadow gshadow; do
if [ $TYPE = 'generic' ]; then
if [ -f /etc/$file ]; then
ln -sf /etc/$file /data/entware/etc/$file
else
[ -f /data/entware/etc/$file.1 ] && cp /data/entware/etc/$file.1 /data/entware/etc/$file
fi
else
if [ -f /data/entware/etc/$file.1 ]; then
cp /data/entware/etc/$file.1 /data/entware/etc/$file
fi
fi
done
[ -f /etc/localtime ] && ln -sf /etc/localtime /data/entware/etc/localtime
echo 'Info: Congratulations!'
echo 'Info: If there are no errors above then Entware was successfully initialized.'
echo 'Info: Add /data/entware/bin & /data/entware/sbin to $PATH variable'
echo 'Info: Add "/data/entware/etc/init.d/rc.unslung start" to startup script for Entware services to start'
if [ $TYPE = 'alternative' ]; then
echo 'Info: Use ssh server from Entware for better compatibility.'
fi
echo 'Info: Found a Bug? Please report at https://github.com/Entware/Entware/issues'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment