#!/bin/bash # Bash login file that is symlinked for each package user # Source the main functions source `which ttPM-funcs` 2>/dev/null || exit 1 TT_BYPASS_LOGOUT="true" # Disable the hashing of commands set +h # Print package name and package lines from /etc/passwd and /etc/group printMsg info "Package -> $TT_PKG_NAME" # Check if the pkg user is already logged in, if so deny access. Else lock the user if [ -f ~/.Loggedin ] then printMsg failure "$TT_PKG_NAME is already logged in..." exit fi touch ~/.Loggedin # If pkg is not used currently, skip the package if [ -f ~/.empty ] then printMsg warning "Package is empty" rm -f $TT_LIB_FILES_DIR/$TT_PKG_NAME $TT_TRACE_FILES_DIR/$TT_PKG_NAME $TT_DEP_FILES_DIR/$TT_PKG_NAME exit fi TT_BYPASS_LOGOUT="false" # Create dirs if they do not exist install -d $TT_PKG_SRC_DIR $TT_PKG_PATCH_DIR $TT_PKG_DATA_DIR $TT_PKG_LOCAL_DATA_DIR $TT_PKG_BUILD_DIR $TT_PKG_BACKUP_DIR $TT_PKG_CONFIG_DIR # Use the wrapper scripts first to prevent install failures export PATH=$TT_PKG_LOCAL_DATA_DIR/bin:$TT_PKG_DATA_DIR/bin:${TT_LIB_DIR}:/usr/bin:/bin:/usr/sbin:/sbin:$PATH # Env Vars for special packages # Classpath should be set based on the need by the build script unset CLASSPATH # Language catalogs to install. Commented out coz it is easier to delete the unwanted catalogs. #export LINGUAS="en fr gu hi mr" # Make the prompt different to easily decipher we are a pkg-user export PS1="\[\033[01;30m\][\t]\[\033[0m\] \[\033[04;31m\]{PKG: \u}\[\033[0m\] \[\033[1;36m\]\w\[\033[0m\] \n \[\033[1m\]\$\[\033[0m\] " # Prefixes for installing apps export Pu="--prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --sharedstatedir=/var/cache --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man" export Pt="--prefix=/opt/misc --exec-prefix=/opt/misc --sysconfdir=/opt/misc/etc --sharedstatedir=${TT_PKG_TMP_DIR}/cache --localstatedir=${TT_PKG_TMP_DIR}/var --infodir=${TT_PKG_TMP_DIR}/info --mandir=${TT_PKG_TMP_DIR}/man" export Pv="--prefix=${TT_PKG_TMP_DIR}/ --exec-prefix=${TT_PKG_TMP_DIR} --sysconfdir=${TT_PKG_TMP_DIR}/etc --sharedstatedir=${TT_PKG_TMP_DIR}/cache --localstatedir=${TT_PKG_TMP_DIR}/var --infodir=${TT_PKG_TMP_DIR}/info --mandir=${TT_PKG_TMP_DIR}/man" cd # Backup config files backupConfig 2>/dev/null # Create tmp dir for pkg install -d $TT_PKG_TMP_DIR # Source pkg specific profile if [ -f $TT_PKG_DATA_DIR/PKG_profile ] then source $TT_PKG_DATA_DIR/PKG_profile fi # Make everything readable by everyone chmod -R go+r ${HOME} 2>/dev/null # Print Flags FLAGS="" for F in $(ls 2* 2>/dev/null) do FLAGS="$FLAGS $F" done printMsg error "Flags:$FLAGS" # Check if trace is to be turned on if [ -f $TT_FLAGS_DIR/doTrace ] then export TT_DO_TRACE=true fi # If the checkversion file exists, check for a new pkg version if [ -f $TT_FLAGS_DIR/checkVersion ] then checkNewVersion fi # If the autobuild file exists, build the packages automatically. if [ -f $TT_FLAGS_DIR/autoBuild ] then rebuildPkg || BUILD_FAILED=true fi # If the autologout file exists, logout the user. if [ -z "$BUILD_FAILED" ] then if [ -f $TT_FLAGS_DIR/autoLogout ] then pkgFiles logout fi fi