WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: separating own tcz's from repo tcz's  (Read 6519 times)

Offline ttz

  • Jr. Member
  • **
  • Posts: 82
separating own tcz's from repo tcz's
« on: October 17, 2015, 06:08:48 PM »
create own tcz

in /optional, mkdir yourdir (for me it was, "mine").

cp own tcz to /optional/yourdir

edit onboot.lst if desired. for me, an example is tmux, so in onboot.lst i have:

mine/tmux.tcz

reason/benefit:

I've been floundering about building stuff and got lost; forgot what was mine. Now I know.

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: separating own tcz's from repo tcz's
« Reply #1 on: October 17, 2015, 07:32:54 PM »
Nice trick. Just tried it and found that Apps doesn't, unfortunately, recognize the sub-directory if wanting to manage OnBoot/OnDemand via GUI. I do something similar, just prepend extensions with PE (personal extension, eg PE-SMPlayer.tcz) and keep them in /optional proper. Easy fo find, just scroll down to the 'P' section.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: separating own tcz's from repo tcz's
« Reply #2 on: October 19, 2015, 11:41:58 AM »
Right, no explicit support for subdirs, so things may break.
The only barriers that can stop you are the ones you create yourself.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: separating own tcz's from repo tcz's
« Reply #3 on: February 26, 2016, 08:24:50 AM »
Hi,
I'm using and testing this since ttz posted it (thanks), with just a slight modification, I symlink the extensions to  ../optional  and there I create a new  *.tcz.md5.txt  file, so updating anything that depends on extensions which I have replaced with custom versions, won't fail due to md5 sum mismatch.
Installing new extensions is another story though - this still needs the original  *.tcz.md5.txt  file as it is on the repo server.
But this means less work is involved from my side compared to creating extensions with different names with the risk of loading one app twice or just replacing the extensions and wasting disk space by keeping backups (which would still produce md5 sum mismatches).

I think that's a quite good solution for using custom extensions and, at the same time, protecting them from being 'updated'.

This is my current  /usr/bin/tce-setup  with an added boot code to automate the symlinking:
Code: [Select]
#!/bin/busybox ash
#(c) Robert Shingledecker 2009-2011
# Stuff added by Misalf...
# + Cosmetics.
# + New boot code: lsts=
#   Based on code from tinycore forums user theYinYeti.
#   Loads extensions from additional .lst files before loading "onboot.lst" or lst="foo.lst".
#   Example: lsts=Xorg.lst,nvidia.lst,whatever.lst,...
# + New boot code parameter: showapps=xyz (For now, any value has the same result).
#   Displays currently processed .lsts while booting (see lsts= boot code) when not using "showapps" boot code (without ="value").
# + Don't delete upgrade directory but only its content ("$TCEDIR"/optional/upgrade/*). (laziness won't stop my productivity!)
# + New boot code: override
#   Creates symlinks from  "$TCEDIR"/optional/override/*.tcz  to  "$TCEDIR"/optional .

. /etc/init.d/tc-functions
useBusybox
checkroot

read USER < /etc/sysconfig/tcuser
TCEINSTALLED="/usr/local/tce.installed"

DGRAY="$(echo -e '\033[1;30m')"
ORANGE="$(echo -e '\033[0;33m')"

process_normal_tcedir() {
[ -z "$TCE" ] && TCE="$(autoscan 'tce' 'd')"/tce
if [ "$TCE" != "/tce" ]; then
TCE_DEVICE="${TCE%%/*}"
TCE_DIR="${TCE#*/}"
if [ "$TCE_DEVICE" = "$TCE_DIR" ]; then TCE_DIR="tce"; fi
find_mountpoint "$TCE_DEVICE"
if [ -n "$MOUNTPOINT" ]; then
if [ "$MOUNTED" == "yes" ]; then
setupExtnDirs
else
mount "$MOUNTPOINT"
if [ $? == 0 ]; then
UMOUNT="yes"
setupExtnDirs
fi
fi
fi
else
   MOUNTPOINT="/tmp"; TCE_DIR="tce"
fi

[ -x /usr/local/bin/setconmap.sh ] && /usr/local/bin/setconmap.sh

TCEDIR="$MOUNTPOINT"/"$TCE_DIR"
if [ ! -d "$TCEDIR"/optional ]; then
mkdir "$TCEDIR"/optional
chown -R "$USER".staff "$TCEDIR"
fi
[ -L /etc/sysconfig/tcedir ] && rm -f /etc/sysconfig/tcedir
ln -sf "$TCEDIR" /etc/sysconfig/tcedir
chown -R "$USER".staff "$TCEINSTALLED"
sync
[ "$MOUNTPOINT" == "/tmp" ] && return

# Process any .gzs in tce directory before regular extensions.
if [ "$(ls -A "$TCEDIR"/*.gz 2>/dev/null)" ]; then
process_gz "$TCEDIR"
fi

if [ -d "$TCEDIR"/optional/upgrade ] && [ "$(ls -A "$TCEDIR"/optional/upgrade 2>/dev/null)" ]; then
echo -n "${DGRAY}- ${GREEN}Performing upgrade from ${YELLOW}$TCEDIR/optional/upgrade${DGRAY} ...${NORMAL}"
yes y | cp -ai "$TCEDIR"/optional/upgrade/* "$TCEDIR"/optional/. 2>/dev/null && rm -rf "$TCEDIR"/optional/upgrade/*
echo -n "${DGRAY}Done -${NORMAL}"
fi

if [ -n "$OVERRIDE" ]; then
[ -d "$TCEDIR"/optional/"$OVERRIDE" ] || OVERRIDE="override"
if [ -d "$TCEDIR"/optional/"$OVERRIDE" ]; then
if [ -d "$TCEDIR"/optional/"$OVERRIDE"/upgrade ] && [ "$(ls -A "$TCEDIR"/optional/"$OVERRIDE"/upgrade 2>/dev/null)" ]; then
echo -n "${DGRAY}- ${GREEN}Performing upgrade from ${YELLOW}$TCEDIR/optional/"$OVERRIDE"/upgrade${DGRAY} ...${NORMAL}"
yes y | cp -ai "$TCEDIR"/optional/"$OVERRIDE"/upgrade/* "$TCEDIR"/optional/"$OVERRIDE"/. 2>/dev/null && rm -rf "$TCEDIR"/optional/"$OVERRIDE"/upgrade/*
echo -n "${DGRAY}Done -${NORMAL}"
fi
echo -n "${DGRAY} (overriding .TCZs) ${NORMAL}"
cd "$TCEDIR"/optional
for i in "$OVERRIDE"/*.tcz
do
OVERRIDE_TCZ="${i##*/}"
ln -sf $i $OVERRIDE_TCZ
#md5sum "${OVERRIDE_TCZ}" > "${OVERRIDE_TCZ}".md5.txt
if [ ! -e "${OVERRIDE_TCZ}".dep ] && [ -e "${i}".dep ]; then
cp ${i}.dep ${OVERRIDE_TCZ}.dep
fi
done
cd - >/dev/null
fi
fi

### Process regular extensions - from several '*.lst's (theYinYeti's way).
LOADFROM="$TCEDIR"/optional
if [ -n "$MORE_LSTS" ]; then
echo -en "${DGRAY}(${ORANGE}lsts=${DGRAY})${YELLOW}"
for xtralsts in $(echo $MORE_LSTS | tr , " "); do
if [ -f "$TCEDIR/$xtralsts" ]; then
echo -n "${MAGENTA} $xtralsts${DGRAY}: ${YELLOW}"
process "$TCEDIR"/"$xtralsts"
else
echo -n "${DGRAY} :(${RED} $xtralsts not found${DGRAY}!"
fi
done
[ "$TARGETLIST" == "onboot.lst" ] && echo -en " ${DGRAY}(${ORANGE}default${DGRAY})" || echo -en " ${DGRAY}(${ORANGE}lst=${DGRAY})"
fi
# Process regular extensions
ONBOOT="$TCEDIR"/"$TARGETLIST"
if [ -s "$ONBOOT" ]; then
echo -n "${MAGENTA} $TARGETLIST${DGRAY}: ${YELLOW}"
process "$ONBOOT"

echo -n "${DGRAY}..."
else
echo -n "${RED} $TARGETLIST not found${DGRAY}!"
fi
sync
}

setupExtnDirs() {
[ -d "$MOUNTPOINT"/"$TCE_DIR"/optional ] || mkdir -p "$MOUNTPOINT"/"$TCE_DIR"/optional
[ -d "$MOUNTPOINT"/"$TCE_DIR"/ondemand ] || mkdir -p "$MOUNTPOINT"/"$TCE_DIR"/ondemand
touch "$MOUNTPOINT"/"$TCE_DIR"/onboot.lst
chown -R "$USER".staff "$MOUNTPOINT"/"$TCE_DIR" 2>/dev/null
chmod -R g+w "$MOUNTPOINT"/"$TCE_DIR" 2>/dev/null
}

process_gz() {
FILELIST=`ls "$1"/*.gz`
cd /
for FILE in $FILELIST; do
zcat "$FILE" | cpio -idmu > /dev/null 2>&1
GZ="${FILE##*/}"
STARTSCRIPT="$TCEINSTALLED"/"${GZ%.gz}"
[ -s "$STARTSCRIPT" ] && sh "$STARTSCRIPT"
done
cd - > /dev/null
setupHome
}

process() {
[ -f "$1" ] && applist=$(awk -v ORS=" " '{gsub(/#.*/, ""); if ($1~/\w/) print $1;}' "$1")
[ "$applist" ] && su "$USER" -c "tce-load -i -b -t `dirname $1` $applist"
if [ -s /tmp/aberr ]; then
echo "occured while loading:  $applist" >> /tmp/aberr
exit 1
fi
}

process_CD() {
CD="/mnt/${DEV#/dev/}"
mount "$CD" 2>/dev/null
if [ "$?" == 0 ] ; then
if [ -d "$CD"/cde ]; then
LOADFROM="$CD"/cde/optional
CDELIST="$CD"/cde/"$TARGETLIST"
if [ -s "$CDELIST" ]; then
process "$CDELIST"
echo "$LOADFROM" > /etc/sysconfig/cde
fi
else
umount "$CD"
fi
fi
}

for i in `cat /proc/cmdline`; do
case $i in
tce=*) TCE=${i#*=} ;;
lst=*) TARGETLIST=${i#*=} ;;
lsts=*) MORE_LSTS=${i#*=} ;;
showapps=*) SHOWAPPSLSTS=${i#*=} ;;
override=*) OVERRIDE=${i#*=} ;;
esac
case $i in
cde) CDE=1 ;;
base) ONLYBASE=1 ;;
override) OVERRIDE=1 ;;
esac
done

[ -n "$TARGETLIST" ] || TARGETLIST="onboot.lst"

# Process any .gzs before attempting to mount tce directory.
# /tmp/builtin support provided for embedding extensions inside the initrd.
if [ "$(ls -A "/tmp/builtin"/*.gz 2>/dev/null)" ]; then
process_gz "/tmp/builtin"
fi

# Next Check for any tcz initrd builtins
if [ -d /tmp/builtin ] && [ "$(ls -A /tmp/builtin 2>/dev/null)" ]; then
TCEDIR=/tmp/builtin
if [ -s "$TCEDIR"/"$TARGETLIST" ] ; then
echo -n "${MAGENTA} /tmp/builtin${DGRAY}: ${YELLOW}"
process "$TCEDIR"/"$TARGETLIST"
fi
fi

# Next process regular extensions unless BASE boot option has been specified.

if [ "$1" == "booting" ] && [ -n "$ONLYBASE" ]; then
echo "${DGRAY}++ ${GREEN}Skipping regular Extensions${NORMAL}"
TCEDIR="/tmp/tce"
if [ ! -d "$TCEDIR"/optional ]; then
mkdir "$TCEDIR"/optional
chown -R "$USER".staff "$TCEDIR"
fi
else
process_normal_tcedir
fi

# Finally check for CD Extensions if requested
if [ "$CDE" ]; then
# Some cd drives are slow - if cde was requested, wait for udev to settle
[ ! -s /etc/sysconfig/cdroms ] && udevadm settle --timeout 5

if [ -s /etc/sysconfig/cdroms ]; then
for DEV in `cat /etc/sysconfig/cdroms`; do
process_CD
done
fi
fi

# If nothing loaded then also check for pseudo CD, e.g., isohybrid
if [ "$CDE" -a -z "$CDELIST" ]; then
sleep 5
DEV="$(autoscan 'cde' 'd')"
process_CD
fi

# Wrap up by performing updates as may be needed.
if [ -e /etc/sysconfig/newmodules ]; then
depmod -a 2>/dev/null
/sbin/udevadm trigger
fi
/sbin/ldconfig 2>/dev/null
if [ -s /tmp/setup.lst ]; then
for F in `cat /tmp/setup.lst`; do "$F"; done
rm -f /tmp/setup.lst
fi

[ -d /mnt/test ] && rmdir /mnt/test

setupHome


I'm not aware about the actual update and install procedures and how/when which md5 sum files are used (remote or local), so I wasn't able to think about a way to make Core being able to handle custom extensions. Would be nice if it could be done.
Anyone had a look at that already? Any ideas?

Uhm, while writing this.. Maybe it would be enough to just check if the  *.tcz.md5.txt  file is a symlink, and if so, ignore its content and continue with the next  *.tcz.md5.txt  - The user would be responsible for any version mismatches or any mess anyway.
Download a copy and keep it handy: Core book ;)