Spaces:
Sleeping
Sleeping
Upload 9 files
Browse files- asdk.sh +29 -0
- deploy-container/entrypoint.sh +102 -0
- deploy-container/rclone-tasks.json +33 -0
- deploy-container/settings.json +9 -0
- deploy-container/t +0 -0
- keyboard +10 -0
- requirements.txt +1 -0
asdk.sh
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Check if Android SDK is already installed
|
| 4 |
+
if [ -d "$HOME/Android/Sdk" ]; then
|
| 5 |
+
echo "Android SDK is already installed"
|
| 6 |
+
else
|
| 7 |
+
# Download the latest version of the Android SDK
|
| 8 |
+
echo "Downloading Android SDK..."
|
| 9 |
+
wget https://dl.google.com/android/repository/commandlinetools-latest.zip
|
| 10 |
+
|
| 11 |
+
# Unzip the Android SDK
|
| 12 |
+
echo "Unzipping Android SDK..."
|
| 13 |
+
unzip commandlinetools-latest.zip
|
| 14 |
+
|
| 15 |
+
# Move the Android SDK to the user's home directory
|
| 16 |
+
echo "Moving Android SDK to user's home directory..."
|
| 17 |
+
mv commandlinetools-latest $HOME/Android/Sdk
|
| 18 |
+
fi
|
| 19 |
+
|
| 20 |
+
# Update the bashrc file
|
| 21 |
+
echo "Updating bashrc file..."
|
| 22 |
+
echo "export PATH=$HOME/Android/Sdk/tools:$HOME/Android/Sdk/platform-tools" >> ~/.bashrc
|
| 23 |
+
|
| 24 |
+
# Reload the bashrc file
|
| 25 |
+
source ~/.bashrc
|
| 26 |
+
|
| 27 |
+
# Install the latest version of Flutter
|
| 28 |
+
echo "Installing Flutter..."
|
| 29 |
+
flutter doctor
|
deploy-container/entrypoint.sh
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
START_DIR="${START_DIR:-/home/coder/project}"
|
| 4 |
+
|
| 5 |
+
PREFIX="deploy-code-server"
|
| 6 |
+
|
| 7 |
+
mkdir -p $START_DIR
|
| 8 |
+
|
| 9 |
+
# function to clone the git repo or add a user's first file if no repo was specified.
|
| 10 |
+
project_init () {
|
| 11 |
+
[ -z "${GIT_REPO}" ] && echo "[$PREFIX] No GIT_REPO specified" && echo "Example file. Have questions? Join us at https://community.coder.com" > $START_DIR/coder.txt || git clone $GIT_REPO $START_DIR
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
# add rclone config and start rclone, if supplied
|
| 15 |
+
if [[ -z "${RCLONE_DATA}" ]]; then
|
| 16 |
+
echo "[$PREFIX] RCLONE_DATA is not specified. Files will not persist"
|
| 17 |
+
|
| 18 |
+
# start the project
|
| 19 |
+
project_init
|
| 20 |
+
|
| 21 |
+
else
|
| 22 |
+
echo "[$PREFIX] Copying rclone config..."
|
| 23 |
+
mkdir -p /home/coder/.config/rclone/
|
| 24 |
+
touch /home/coder/.config/rclone/rclone.conf
|
| 25 |
+
echo $RCLONE_DATA | base64 -d > /home/coder/.config/rclone/rclone.conf
|
| 26 |
+
sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
|
| 27 |
+
|
| 28 |
+
# default to true
|
| 29 |
+
RCLONE_VSCODE_TASKS="${RCLONE_VSCODE_TASKS:-true}"
|
| 30 |
+
RCLONE_AUTO_PUSH="${RCLONE_AUTO_PUSH:-true}"
|
| 31 |
+
RCLONE_AUTO_PULL="${RCLONE_AUTO_PULL:-true}"
|
| 32 |
+
|
| 33 |
+
if [ $RCLONE_VSCODE_TASKS = "true" ]; then
|
| 34 |
+
# copy our tasks config to VS Code
|
| 35 |
+
echo "[$PREFIX] Applying VS Code tasks for rclone"
|
| 36 |
+
cp /tmp/rclone-tasks.json /home/coder/.local/share/code-server/User/tasks.json
|
| 37 |
+
# install the extension to add to menu bar
|
| 38 |
+
code-server --install-extension actboy168.tasks&
|
| 39 |
+
else
|
| 40 |
+
# user specified they don't want to apply the tasks
|
| 41 |
+
echo "[$PREFIX] Skipping VS Code tasks for rclone"
|
| 42 |
+
fi
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# Full path to the remote filesystem
|
| 47 |
+
RCLONE_REMOTE_PATH=${RCLONE_REMOTE_NAME:-code-server-remote}:${RCLONE_DESTINATION:-code-server-files}
|
| 48 |
+
RCLONE_SOURCE_PATH=${RCLONE_SOURCE:-$START_DIR}
|
| 49 |
+
echo "rclone sync $RCLONE_SOURCE_PATH $RCLONE_REMOTE_PATH $RCLONE_FLAGS -vv" > /home/coder/push_remote.sh
|
| 50 |
+
echo "rclone sync $RCLONE_REMOTE_PATH $RCLONE_SOURCE_PATH $RCLONE_FLAGS -vv" > /home/coder/pull_remote.sh
|
| 51 |
+
chmod +x push_remote.sh pull_remote.sh
|
| 52 |
+
|
| 53 |
+
if rclone ls $RCLONE_REMOTE_PATH; then
|
| 54 |
+
|
| 55 |
+
if [ $RCLONE_AUTO_PULL = "true" ]; then
|
| 56 |
+
# grab the files from the remote instead of running project_init()
|
| 57 |
+
echo "[$PREFIX] Pulling existing files from remote..."
|
| 58 |
+
/home/coder/pull_remote.sh&
|
| 59 |
+
else
|
| 60 |
+
# user specified they don't want to apply the tasks
|
| 61 |
+
echo "[$PREFIX] Auto-pull is disabled"
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
+
else
|
| 65 |
+
|
| 66 |
+
if [ $RCLONE_AUTO_PUSH = "true" ]; then
|
| 67 |
+
# we need to clone the git repo and sync
|
| 68 |
+
echo "[$PREFIX] Pushing initial files to remote..."
|
| 69 |
+
project_init
|
| 70 |
+
/home/coder/push_remote.sh&
|
| 71 |
+
else
|
| 72 |
+
# user specified they don't want to apply the tasks
|
| 73 |
+
echo "[$PREFIX] Auto-push is disabled"
|
| 74 |
+
fi
|
| 75 |
+
|
| 76 |
+
fi
|
| 77 |
+
|
| 78 |
+
fi
|
| 79 |
+
|
| 80 |
+
# Add dotfiles, if set
|
| 81 |
+
if [ -n "$DOTFILES_REPO" ]; then
|
| 82 |
+
# grab the files from the remote instead of running project_init()
|
| 83 |
+
echo "[$PREFIX] Cloning dotfiles..."
|
| 84 |
+
mkdir -p $HOME/dotfiles
|
| 85 |
+
git clone $DOTFILES_REPO $HOME/dotfiles
|
| 86 |
+
|
| 87 |
+
DOTFILES_SYMLINK="${RCLONE_AUTO_PULL:-true}"
|
| 88 |
+
|
| 89 |
+
# symlink repo to $HOME
|
| 90 |
+
if [ $DOTFILES_SYMLINK = "true" ]; then
|
| 91 |
+
shopt -s dotglob
|
| 92 |
+
ln -sf source_file $HOME/dotfiles/* $HOME
|
| 93 |
+
fi
|
| 94 |
+
|
| 95 |
+
# run install script, if it exists
|
| 96 |
+
[ -f "$HOME/dotfiles/install.sh" ] && $HOME/dotfiles/install.sh
|
| 97 |
+
fi
|
| 98 |
+
|
| 99 |
+
echo "[$PREFIX] Starting code-server..."
|
| 100 |
+
# Now we can run code-server with the default entrypoint
|
| 101 |
+
sed -i.bak 's/auth: password/auth: none/' ~/.config/code-server/config.yaml
|
| 102 |
+
/usr/bin/entrypoint.sh --bind-addr 0.0.0.0:8080 $START_DIR
|
deploy-container/rclone-tasks.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "2.0.0",
|
| 3 |
+
"tasks": [
|
| 4 |
+
{
|
| 5 |
+
"label": "push_remote",
|
| 6 |
+
"type": "shell",
|
| 7 |
+
"command": "sh /home/coder/push_remote.sh",
|
| 8 |
+
"presentation": {
|
| 9 |
+
"reveal": "always"
|
| 10 |
+
},
|
| 11 |
+
"problemMatcher": [],
|
| 12 |
+
"options": {
|
| 13 |
+
"statusbar": {
|
| 14 |
+
"label": "$(repo-push) rclone: push"
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"label": "pull_remote",
|
| 20 |
+
"type": "shell",
|
| 21 |
+
"command": "sh /home/coder/pull_remote.sh",
|
| 22 |
+
"presentation": {
|
| 23 |
+
"reveal": "always"
|
| 24 |
+
},
|
| 25 |
+
"problemMatcher": [],
|
| 26 |
+
"options": {
|
| 27 |
+
"statusbar": {
|
| 28 |
+
"label": "$(repo-pull) rclone: pull"
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
]
|
| 33 |
+
}
|
deploy-container/settings.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"workbench.colorTheme": "Default Light+",
|
| 3 |
+
"git.postCommitCommand": "sync",
|
| 4 |
+
"git.enableSmartCommit": true,
|
| 5 |
+
"git.confirmSync": false,
|
| 6 |
+
"git.autofetch": true,
|
| 7 |
+
"editor.minimap.enabled": false,
|
| 8 |
+
"emmet.triggerExpansionOnTab": true,
|
| 9 |
+
}
|
deploy-container/t
ADDED
|
File without changes
|
keyboard
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KEYBOARD CONFIGURATION FILE
|
| 2 |
+
|
| 3 |
+
# Consult the keyboard(5) manual page.
|
| 4 |
+
|
| 5 |
+
XKBMODEL="pc105"
|
| 6 |
+
XKBLAYOUT="us"
|
| 7 |
+
XKBVARIANT=""
|
| 8 |
+
XKBOPTIONS=""
|
| 9 |
+
|
| 10 |
+
BACKSPACE="guess"
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
chikku
|