-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-mint-wallpaper.sh
120 lines (77 loc) · 2.71 KB
/
get-mint-wallpaper.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
# Linux Mint Wallpaper Retriever
# This is to facilitate the easy download of Linux mint backgrounds for Windows 10 users.
# (Mint has pretty good backgrounds, if you didn't know)
# This assumes you have WSL with Linux PowerShell installed. Usage:
# source get-mind-wallpaper.sh
# this was written in WSL, to automate getting the nice Linux Mint backgrounds
# for use in Windows. Puts these in a "mint-backgrounds" directory, opens them in explorer at the end.
# (this is mostly meant as a review for my GNU/Linux Bash scripting, it's nothing special.)
# BTW this assumes that your WSL username is the same as your Windows username!!!
pushd=`pwd`
if [ ! -d "${HOME}/backgrounds" ]; then
mkdir "${HOME}/backgrounds"
fi
# get a few other backgrounds from the net
# as desired here...
# use Powershell script to download deb files.
pwsh "./retrieve-deb-files.ps1"
if [ -d "${HOME}/temp0" ]; then
rm -rf "${HOME}/temp0"
fi
mkdir "${HOME}/temp0"
if [ -d "${HOME}/mint-backgrounds" ]; then
rm -rf "${HOME}/mint-backgrounds"
fi
mkdir "${HOME}/mint-backgrounds"
export index0="0"
cd "${HOME}/temp0"
for fn in "${HOME}/backgrounds/"* ; do
#echo "fn : ${fn} : done with fn."
if [ ! -d $fn ]; then
if [ ${fn: -3} == "deb" ]; then
# data can be stored in deb files as xz or gz.... be sure to check here.
if ar t $fn | grep -q "data.tar.xz" ; then
ar x $fn data.tar.xz
xz -d data.tar.xz
elif ar t $fn | grep -q "data.tar.gz" ; then
ar x $fn data.tar.gz
gunzip data.tar.gz
fi
tar -xf ./data.tar "./usr/share/backgrounds"
export index1=0
for img in "./usr/share/backgrounds/"* ; do
cp -rf "${img}" "${HOME}/mint-backgrounds/"
rm -rf "${img}"
export index1=`expr $index1 + 1`
done
rm -rf *
export index0=`expr $index0 + 1`
fi
fi
done
cd $HOME
export realdir="/mnt/c/Users/${USER}/mint-backgrounds/"
if [ -d $realdir ]; then
rm -rf $realdir
fi
mkdir $realdir
cd "${HOME}/mint-backgrounds"
# iterate through all of the directories, moving jpgs to windows dir.
for dir in * ; do
if [ -d $dir ]; then
# should use some regex here to only send over jpg and png..
for fn in "${dir}/"* ; do
cp -rf $fn $realdir
rm -rf $fn
done
#mv "${dir}/"*.jpg $realdir
fi
done
#* "${realdir}"
#" source ./cleanup.sh
rm -rf "${HOME}/mint-backgrounds"
rm -rf "${HOME}/temp0"
echo "done extracting backgrounds."
explorer.exe "C:\\Users\\${USER}\\mint-backgrounds"
cd $pushd