Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update crackle for focal #14

Merged
merged 13 commits into from
Apr 11, 2024
2 changes: 1 addition & 1 deletion bin
Submodule bin updated from b9aad6 to 096b85
5 changes: 3 additions & 2 deletions crackle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PKG=("${@:2}")
# Configuration for Apt
APTCACHE=${APTCACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/apt};
APTSTATE=${APTSTATE:-${XDG_STATE_HOME:-$HOME/.local/state}/apt};
DPKGSTATE=${DPKGSTATE:-${XDG_STATE_HOME:-$HOME/.local/state}/dpkg};
APTCONFIG=${APTCONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/crackle};

# Configuration for Crackle
Expand Down Expand Up @@ -50,15 +51,15 @@ else
source "$SCRP_DIR/lib/triplet";
fi

checkpath;
if [[ -z "$CI" ]]; then checkpath; fi
# Root check
if [[ -z "$CI" ]]; then root_check; fi

load_lib pkgfunc;
load_lib linkfunc;
load_lib clickfunc;

if [[ "$CLICKABLE" = true ]]; then pkgsetup; fi
if [[ "$CI" = true && ! -d /root/.config/crackle ]]; then pkgsetup; fi

# click config
ROOT=${ROOT:-$(pwd)}
Expand Down
2 changes: 1 addition & 1 deletion lib/linkfunc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function link(){
if [ -f ${1}/$pkg ]; then
ln -s ${1}/$pkg ${2};
elif [ -f ${1}/$ARCH_TRIPLET/$pkg ]; then
ln -s ${1}/$ARCH_TRIPLET/$pkg ${2};
[ ! -f ${2}/$pkg ] && ln -s ${1}/$ARCH_TRIPLET/$pkg ${2};
elif [ -d ${1}/${pkg} ]; then
ln -s ${1}/$pkg ${2};
else
Expand Down
11 changes: 8 additions & 3 deletions lib/pkgfunc
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,18 @@ function pkgstatus(){
}

function pkgsetup(){
say "configuring crackle";
[[ -d "$DPKGSTATE" ]] || {
mkdir -p "$DPKGSTATE";
cp /var/lib/dpkg/status $DPKGSTATE/status;
}
[[ -d "$APTCACHE" ]] || mkdir -p "$APTCACHE";
[[ -d "$APTSTATE" ]] || mkdir -p "$APTSTATE";
[[ -d "$APTCONFIG" ]] || {
mkdir -p $APTCONFIG/sources.list.d $APTCONFIG/preferences.d $APTCONFIG/trusted.gpg.d;
mkdir -p $APTCONFIG/sources.list.d $APTCONFIG/preferences.d $PKG_PATH/usr/share/keyrings;
ln -s $PKG_PATH/usr/share/keyrings $APTCONFIG/trusted.gpg.d
ln -s /etc/apt/sources.list $APTCONFIG;
ln -s /etc/apt/trusted.gpg $APTCONFIG;
[[ -n "$(ls /etc/apt/trusted.gpg.d)" ]] && ln -s /etc/apt/trusted.gpg.d/* $APTCONFIG/trusted.gpg.d/;
[[ -n "$(ls /etc/apt/trusted.gpg.d)" ]] && ln -s /etc/apt/trusted.gpg.d/* $PKG_PATH/usr/share/keyrings/;
}
[ -d "$APTSTATE/lists" ] || {
say "Fetching package lists...";
Expand Down
20 changes: 3 additions & 17 deletions lib/triplet
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ rm_rorw(){
err "remounting failed! crackle works best on a readonly rootfs";
}
checkro() {
if [[ $(rorw) = "rw" && $(lsb_release -rs) = "16.04" ]]; then
if [[ $(rorw) = "rw" && $(lsb_release -cs) = "focal" ]]; then
echo "remounting rootfs as readonly....";
remount || rm_rorw;
elif [[ ! $(lsb_release -cs) = "focal" ]]; then
err "$(lsb_release -cs) is not supported";
fi
}

Expand Down Expand Up @@ -74,7 +76,6 @@ unzip_crackle() {
upgrade_crackle() {
[[ ! -f $HOME/Downloads/crackle.zip ]] && download_crackle;
[[ ! -d $HOME/crackle ]] && unzip_crackle;
transistion_crackle
$HOME/crackle/crackle setup
say "cleaning up..."
rm -r $HOME/crackle;
Expand All @@ -83,21 +84,6 @@ upgrade_crackle() {
exit 0;
}

# remove lines, files and folders that crackle added/installed once upon a time
transistion_crackle() {
[[ -f "$PKG_PATH/bin/awkopts" ]] && rm $PKG_PATH/bin/awkopts;
[[ -f "$PKG_PREFIX/bin/awkopts" ]] && rm $PKG_PREFIX/bin/awkopts;
[[ -f "$PKG_PREFIX/lib/loginfo" ]] && rm $PKG_PREFIX/lib/loginfo;
[ -d $PKG_PATH/lib ] && rm -r $PKG_PATH/lib;
[[ -d "$HOME/.cache/crackle" ]] && rm -r $HOME/.cache/crackle;
[[ -d "$HOME/.local/state/crackle" ]] && rm -r $HOME/.local/state/crackle;
[[ -d "$APTCACHE/lists" ]] && rm -r "$APTCACHE/lists";
[[ -d "$PKG_PREFIX/bin/scripts" ]] && rm -r "$PKG_PREFIX/bin/scripts";
[[ -f "$APTCONFIG/crackle_completion" ]] && rm "$APTCONFIG/crackle_completion";
[[ -d "$PKG_PATH/bin/scripts" ]] && rm -r "$PKG_PATH/bin/scripts";
[ -f $HOME/.bash_completion ] && sed -i '/crackle_completion/d' $HOME/.bash_completion
}

# check is a command exists
check_cmd() {
command -v "$1" > /dev/null 2>&1
Expand Down
Loading