Skip to content

Commit

Permalink
Merge pull request #50 from tsirysndr/fix/install-prefix
Browse files Browse the repository at this point in the history
set default install PREFIX to /usr/local
  • Loading branch information
tsirysndr authored Oct 31, 2024
2 parents 7b73fa3 + 38145f9 commit c838bca
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
20 changes: 10 additions & 10 deletions .fluentci/plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ pub fn release(_args: String) -> FnResult<String> {
"cd zig-out/bin && sha256sum rockboxd_${TAG}_${TARGET}.tar.gz > rockboxd_${TAG}_${TARGET}.tar.gz.sha256",
])?
.with_exec(vec![
"cd /root/.local/lib/rockbox && tar czvf rockbox-codecs-${TAG}-${TARGET}.tar.gz *",
"cd /usr/local/lib/rockbox && tar czvf rockbox-codecs-${TAG}-${TARGET}.tar.gz *",
])?
.with_exec(vec![
"cd /root/.local/lib/rockbox && sha256sum rockbox-codecs-${TAG}-${TARGET}.tar.gz > rockbox-codecs-${TAG}-${TARGET}.tar.gz.sha256",
"cd /usr/local/lib/rockbox && sha256sum rockbox-codecs-${TAG}-${TARGET}.tar.gz > rockbox-codecs-${TAG}-${TARGET}.tar.gz.sha256",
])?
.with_exec(vec![
"cd /root/.local/share/rockbox && tar czvf rockbox-assets-${TAG}-${TARGET}.tar.gz *",
"cd /usr/local/share/rockbox && tar czvf rockbox-assets-${TAG}-${TARGET}.tar.gz *",
])?
.with_exec(vec![
"cd /root/.local/share/rockbox && sha256sum rockbox-assets-${TAG}-${TARGET}.tar.gz > rockbox-assets-${TAG}-${TARGET}.tar.gz.sha256",
"cd /usr/local/share/rockbox && sha256sum rockbox-assets-${TAG}-${TARGET}.tar.gz > rockbox-assets-${TAG}-${TARGET}.tar.gz.sha256",
])?
.stdout()?;

Expand Down Expand Up @@ -95,33 +95,33 @@ pub fn release(_args: String) -> FnResult<String> {
"release",
"upload",
"${TAG}",
"/root/.local/lib/rockbox/rockbox-codecs-${TAG}-${TARGET}.tar.gz",
"/usr/local/lib/rockbox/rockbox-codecs-${TAG}-${TARGET}.tar.gz",
])?
.with_exec(vec![
"gh",
"release",
"upload",
"$TAG",
"/root/.local/lib/rockbox/rockbox-codecs-${TAG}-${TARGET}.tar.gz.sha256",
"/usr/local/lib/rockbox/rockbox-codecs-${TAG}-${TARGET}.tar.gz.sha256",
])?
.with_exec(vec![
"gh",
"release",
"upload",
"${TAG}",
"/root/.local/share/rockbox/rockbox-assets-${TAG}-${TARGET}.tar.gz",
"/usr/local/share/rockbox/rockbox-assets-${TAG}-${TARGET}.tar.gz",
])?
.with_exec(vec![
"gh",
"release",
"upload",
"${TAG}",
"/root/.local/share/rockbox/rockbox-assets-${TAG}-${TARGET}.tar.gz.sha256",
"/usr/local/share/rockbox/rockbox-assets-${TAG}-${TARGET}.tar.gz.sha256",
])?
.with_exec(vec![
"rm",
"/root/.local/lib/rockbox/*.tar.gz*",
"/root/.local/share/rockbox/*.tar.gz*",
"/usr/local/lib/rockbox/*.tar.gz*",
"/usr/local/share/rockbox/*.tar.gz*",
])?
.stdout()?;

Expand Down
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ COPY . /app

WORKDIR /app

RUN mkdir -p build /root/.local/lib/rockbox
RUN mkdir -p build

WORKDIR /app/webui/rockbox

Expand All @@ -39,7 +39,7 @@ RUN bun run build

WORKDIR /app/build

RUN ../tools/configure --target=sdlapp --type=N --lcdwidth=320 --lcdheight=240 --prefix=$HOME/.local
RUN ../tools/configure --target=sdlapp --type=N --lcdwidth=320 --lcdheight=240 --prefix=/usr/local

RUN make ziginstall -j$(nproc)

Expand All @@ -62,9 +62,11 @@ RUN apt-get update && apt-get install -y \
libasound2 \
pulseaudio

COPY --from=builder /root/.local /root/.local
COPY --from=builder /usr/local/lib/rockbox /usr/local/lib/rockbox

COPY --from=builder /root/.local/bin/rockboxd /usr/bin/rockboxd
COPY --from=builder /usr/local/share/rockbox /usr/local/share/rockbox

COPY --from=builder /usr/local/bin/rockboxd /usr/local/bin/rockboxd

ENV SDL_VIDEODRIVER=dummy

Expand Down
39 changes: 26 additions & 13 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DOWNLOAD_URL=$(curl -sSL "$RELEASE_URL" | grep -o "browser_download_url.*rockbox

ASSET_NAME=$(basename $DOWNLOAD_URL)

INSTALL_DIR="$HOME/.local/bin"
INSTALL_DIR="/usr/local/bin"

DOWNLOAD_URL=`echo $DOWNLOAD_URL | tr -d '\"'`

Expand All @@ -67,7 +67,11 @@ tar -xzf /tmp/$ASSET_NAME -C /tmp
# Set the correct permissions for the binary
chmod +x /tmp/rockbox

mv /tmp/rockbox $INSTALL_DIR
if command -v sudo >/dev/null 2>&1; then
sudo mv /tmp/rockbox $INSTALL_DIR
else
mv /tmp/rockbox $INSTALL_DIR
fi

if command -v apt-get >/dev/null 2>&1; then
if command -v sudo >/dev/null 2>&1; then
Expand Down Expand Up @@ -162,7 +166,11 @@ tar -xzf /tmp/$ASSET_NAME -C /tmp
# Set the correct permissions for the binary
chmod +x /tmp/rockboxd

mv /tmp/rockboxd $INSTALL_DIR
if command -v sudo >/dev/null 2>&1; then
sudo mv /tmp/rockboxd $INSTALL_DIR
else
mv /tmp/rockboxd $INSTALL_DIR
fi

# Install Rockbox assets

Expand All @@ -185,8 +193,13 @@ curl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
mkdir -p /tmp/rockbox-assets
tar -xzf /tmp/$ASSET_NAME -C /tmp/rockbox-assets

mkdir -p $INSTALL_DIR/../share/rockbox
cp -r /tmp/rockbox-assets/* $INSTALL_DIR/../share/rockbox
if command -v sudo >/dev/null 2>&1; then
sudo mkdir -p $INSTALL_DIR/../share/rockbox
sudo cp -r /tmp/rockbox-assets/* $INSTALL_DIR/../share/rockbox
else
mkdir -p $INSTALL_DIR/../share/rockbox
cp -r /tmp/rockbox-assets/* $INSTALL_DIR/../share/rockbox
fi

# Install Rockbox Codecs

Expand All @@ -207,14 +220,14 @@ curl -SL $DOWNLOAD_URL -o /tmp/$ASSET_NAME
# Extract the asset
tar -xzf /tmp/$ASSET_NAME -C /tmp

mkdir -p $INSTALL_DIR/../lib/rockbox
cp -r /tmp/codecs $INSTALL_DIR/../lib/rockbox
cp -r /tmp/rocks $INSTALL_DIR/../lib/rockbox

# detect if user can run rockboxd, if not add $HOME/.local/bin to PATH
if ! command -v rockboxd >/dev/null 2>&1; then
echo "export PATH=\"\$HOME/.local/bin:\$PATH\"" >> $HOME/.bashrc
export PATH="$HOME/.local/bin:$PATH"
if command -v sudo >/dev/null 2>&1; then
sudo mkdir -p $INSTALL_DIR/../lib/rockbox
sudo cp -r /tmp/codecs $INSTALL_DIR/../lib/rockbox
sudo cp -r /tmp/rocks $INSTALL_DIR/../lib/rockbox
else
mkdir -p $INSTALL_DIR/../lib/rockbox
cp -r /tmp/codecs $INSTALL_DIR/../lib/rockbox
cp -r /tmp/rocks $INSTALL_DIR/../lib/rockbox
fi

cat <<EOF
Expand Down

0 comments on commit c838bca

Please sign in to comment.