Here is a little script to automate everything sorry for the multiple posts on an old thread but I can't seem to edit them.
Copy the script onto
/mnt/us/ and make sure to
chmod +x
[#] First run
[#] After restart to mount only and export PATH
-m param i.e
[#] Installing a package
Code:
ipkg -t /opt/tmp install nmap
[#]If you use a different console make sure to
Quote:
export PATH=$PATH:/opt/bin
|
Ipkg.sh
PHP Code:
#!/bin/bash
# Flag to determine whether to mount the existing ext3 image file
MOUNT_ONLY=false
# Set the path to the local.ext3 file
LOCAL_EXT3_FILE="/mnt/us/local.ext3"
# Set the size of the ext3 image file in megabytes
EXT3_IMAGE_SIZE=500
# Export PATH
export PATH=$PATH:/opt/bin
# Function to display script usage
show_usage() {
echo "Usage: $0 [-m]"
echo " -m Mount the existing ext3 image file"
exit 1
}
# Process command-line options
while getopts ":m" opt; do
case $opt in
m)
MOUNT_ONLY=true
;;
\?)
echo "Invalid option: -$OPTARG"
show_usage
;;
esac
done
# Function to create and copy the ext3 image file
create_ext3_image() {
dd if=/dev/zero of="$LOCAL_EXT3_FILE" bs=1M count="$EXT3_IMAGE_SIZE"
mkfs.ext3 "$LOCAL_EXT3_FILE"
cp "$LOCAL_EXT3_FILE" /media/Kindle
}
# Function to mount the ext3 image file
mount_ext3_image() {
mntroot rw
mkdir -p /mnt/loc
mount -o loop,noatime -t ext3 "$LOCAL_EXT3_FILE" /mnt/loc
mkdir -p /mnt/loc/opt/etc /mnt/loc/opt/share /mnt/loc/opt/lib /mnt/loc/opt/bin /mnt/loc/opt/tmp
ln -s /mnt/loc/opt/etc /opt/etc
ln -s /mnt/loc/opt/share /opt/share
ln -s /mnt/loc/opt/lib /opt/lib
ln -s /mnt/loc/opt/bin /opt/bin
ln -s /mnt/loc/opt/tmp /opt/tmp
mntroot ro
}
# Function to install OptWare
install_optware() {
cd /opt/etc
feed="http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable"
wget "${feed}/ipkg-opt_0.99.163-10_arm.ipk"
tar -xOvzf ipkg-opt_0.99.163-10_arm.ipk ./data.tar.gz | tar -C /mnt/loc -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf
ipkg -t /opt/tmp update
}
# Main script
if [ "$MOUNT_ONLY" = false ]; then
create_ext3_image
mount_ext3_image
install_optware
fi
if [ "$MOUNT_ONLY" = true ]; then
mount_ext3_image
fi
.