Skip to content

Commit

Permalink
Update scripts/tc-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
innovarew committed Feb 1, 2024
1 parent 01373e8 commit 539069c
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions scripts/tc-docker
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# @file tc-docker
# @description tc-docker, helper script for building innovarew/docker-tinycore
# @author innovarew <innovarew at github.com> (c) Copyright 2022
# @author innovarew <innovarew at github.com> (c) Copyright 2022 GPLv2
# @copyright All rights reserved. Read LICENSE.txt file for the license terms.
# @url github.com/innovarew/docker-tinycore
#
Expand All @@ -19,8 +19,9 @@
#

PROGNAME=${0##*/}
PROGAUTHOR="innovarew <box> (c) 2022."
PROGVERSION=v1.2
PROGAUTHOR="innovarew"
PROGURL="https://github.com/innovarew/docker-tinycore"

set -euf

Expand All @@ -38,7 +39,7 @@ fi

tce_rootfs_init()
{
TC_VER=$(echo $TC_URL | awk -F/ '{print $4"-"$5}')
TC_VER=$(echo "$TC_URL" | awk -F/ '{print $4"-"$5}')
TC_TAR="rootfs-$TC_VER.tar.xz"
TC_PATCH="rootfs-$TC_VER.patch"

Expand All @@ -57,11 +58,11 @@ tce_rootfs_init()
tce_rootfs_unpack "$@"

# rootfs contains .ko.gz not used by docker
find $PWD/root/ -name '*.ko.gz' -exec rm {} \;
find "$PWD/root/" -name '*.ko.gz' -exec rm {} \;

# get unsquashfs into container to unpack tcz
tce_install liblzma.tcz $PWD/root/
tce_install squashfs-tools.tcz $PWD/root/
tce_install liblzma.tcz "$PWD/root/"
tce_install squashfs-tools.tcz "$PWD/root/"

patch -p2 < $TC_PATCH
)
Expand All @@ -71,7 +72,7 @@ tce_rootfs_init()

tce_rootfs_unpack()
{
ISO_FILE=$(basename "$ISO_URL")
ISO_FILE="${ISO_URL##*/}"

wget -qc "$ISO_URL"
# wget -qc "$ISO_URL.md5.txt" && md5sum -c $(basename "$ISO_URL.md5.txt")
Expand Down Expand Up @@ -107,33 +108,33 @@ tce_install()
local app=$1
local root=$2

if [ -e $root/usr/local/tce.installed/${app%.tcz} ]
if [ -e "$root/usr/local/tce.installed/${app%.tcz}" ]
then
usage "warn: $app already installed in $root"
fi

(
tce_cddir

if wget -qc $TCZ_URL/$app.dep
if wget -qc "$TCZ_URL/$app.dep"
then
for dep in `cat $app.dep`
for dep in $(cat "$app.dep")
do
tce_install $dep $root
done
fi

wget -qc $TCZ_URL/$app
wget -qc $TCZ_URL/$app.md5.txt
[ -e "$app.md5.txt" ] && md5sum -c $app.md5.txt
wget -qc "$TCZ_URL/$app"
wget -qc "$TCZ_URL/$app.md5.txt"
[ -e "$app.md5.txt" ] && md5sum -c "$app.md5.txt"

if [ -n "$UNSQUASHFS" ]
then
unsquashfs -n -d "$root" -f $app >/dev/null
unsquashfs -n -d "$root" -f "$app" >/dev/null

# update system
mkdir -p $root/usr/local/tce.installed/
touch $root/usr/local/tce.installed/${app%.tcz}
mkdir -p "$root/usr/local/tce.installed/"
touch "$root/usr/local/tce.installed/${app%.tcz}"
fi

# update libs
Expand All @@ -150,8 +151,8 @@ tce_info()
local app=$1
(
tce_cddir
[ ! -e $app.info ] && wget -qc $TCZ_URL/$app.info
cat $app.info
[ ! -e "$app.info" ] && wget -qc "$TCZ_URL/$app.info"
cat "$app.info"
)
}

Expand All @@ -161,8 +162,8 @@ tce_list()
local app=$1
(
tce_cddir
[ ! -e $app.list ] && wget -qc $TCZ_URL/$app.list
cat $app.list
[ ! -e "$app.list" ] && wget -qc "$TCZ_URL/$app.list"
cat "$app.list"
)
}

Expand All @@ -172,25 +173,25 @@ tce_dep()
local app=$1
(
tce_cddir
[ ! -e $app.list ] && wget -qc $TCZ_URL/$app.dep
cat $app.dep
[ ! -e "$app.list" ] && wget -qc "$TCZ_URL/$app.dep"
cat "$app.dep"
)
}

tce_search()
{
(
tce_cddir
wget -qc $TCZ_URL
cat $(basename "$TCZ_URL")
wget -qc "$TCZ_URL"
cat "${TCZ_URL##*/}"
)
}

usage()
{
if [ $# -eq 0 ]
then
echo "usage: $PROGNAME [tce_rootfs_init|tce_install] # @version $PROGVERSION @copyright $PROGAUTHOR";
echo "usage: $PROGNAME [tce_rootfs_init|tce_install] # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL";
exit;
else
echo "$@"
Expand Down

0 comments on commit 539069c

Please sign in to comment.